mirror of
https://gitcode.com/Zengtudor/alg2025.git
synced 2025-08-21 18:52:07 +00:00
update
This commit is contained in:
parent
f41c1341a0
commit
8406b59ba4
88
src/8/20/P2312.cpp
Normal file
88
src/8/20/P2312.cpp
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
#include <cctype>
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
using i128 = __int128_t;
|
||||||
|
using ll = int64_t;
|
||||||
|
|
||||||
|
ll n, m;
|
||||||
|
const std::vector<ll> mods = {(ll)1e9+7};
|
||||||
|
std::vector<std::vector<ll>> a;
|
||||||
|
|
||||||
|
ll strp(const std::string &s, ll p) {
|
||||||
|
ll num = 0;
|
||||||
|
int idx = 0;
|
||||||
|
ll nag = 1;
|
||||||
|
if (s[0] == '-') {
|
||||||
|
nag = -1;
|
||||||
|
idx = 1;
|
||||||
|
}
|
||||||
|
for (size_t i = idx; i < s.length(); ++i) {
|
||||||
|
num = (num * 10 + (s[i] - '0')) % p;
|
||||||
|
}
|
||||||
|
num = (num * nag) % p;
|
||||||
|
if (num < 0) {
|
||||||
|
num += p;
|
||||||
|
}
|
||||||
|
return num;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
|
||||||
|
std::ios_base::sync_with_stdio(false);
|
||||||
|
std::cin.tie(NULL);
|
||||||
|
|
||||||
|
std::cin >> n >> m;
|
||||||
|
a.resize(n + 1, std::vector<ll>(mods.size()));
|
||||||
|
for (int i = 0; i <= n; ++i) {
|
||||||
|
std::string tmpstr;
|
||||||
|
std::cin >> tmpstr;
|
||||||
|
for (size_t k = 0; k < mods.size(); ++k) {
|
||||||
|
a[i][k] = strp(tmpstr, mods[k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<ll> sol;
|
||||||
|
sol.reserve(100);
|
||||||
|
|
||||||
|
for (ll i = 1; i <= m; ++i) {
|
||||||
|
bool isok = true;
|
||||||
|
for (size_t k = 0; k < mods.size(); ++k) {
|
||||||
|
|
||||||
|
const ll p = mods[k];
|
||||||
|
const auto &cur = a;
|
||||||
|
|
||||||
|
ll curx = 1;
|
||||||
|
i128 sum = 0;
|
||||||
|
|
||||||
|
for (int j = 0; j <= n; ++j) {
|
||||||
|
|
||||||
|
sum += (i128)cur[j][k] * curx;
|
||||||
|
curx = (curx * i) % p;
|
||||||
|
|
||||||
|
if ((j & 15) == 15) {
|
||||||
|
sum %= p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sum %= p;
|
||||||
|
|
||||||
|
if (sum != 0) {
|
||||||
|
isok = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isok) {
|
||||||
|
sol.push_back(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cout << sol.size() << '\n';
|
||||||
|
for (ll ans : sol) {
|
||||||
|
std::cout << ans << '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user