QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#127826 | #6399. Classic: Classical Problem | UNos_maricones | Compile Error | / | / | C++20 | 2.9kb | 2023-07-20 09:17:41 | 2023-07-20 09:17:43 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-07-20 09:17:43]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-07-20 09:17:41]
- 提交
answer
#include <bits/stdc++.h>
using namespace std ;
#define ff first
#define ss second
#define pb push_back
typedef long long ll;
typedef pair<ll,int> ii;
typedef long double lf;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll SQ = 320;
const ll N = 2e5+5;
const ll mod = 998244353;
const ll oo = 1e14+5;
bitset<N> bt[N];
int powmod (int a, int b, int p) {
int res = 1;
while (b)
if (b & 1)
res = int (res * 1ll * a % p), --b;
else
a = int (a * 1ll * a % p), b >>= 1;
return res;
}
int generator (int p) {
vector<int> fact;
int phi = p-1, n = phi;
for (int i=2; i*i<=n; ++i)
if (n % i == 0) {
fact.push_back (i);
while (n % i == 0)
n /= i;
}
if (n > 1)
fact.push_back (n);
for (int res=2; res<=p; ++res) {
bool ok = true;
for (size_t i=0; i<fact.size() && ok; ++i)
ok &= powmod (res, phi / fact[i], p) != 1;
if (ok) return res;
}
return -1;
}
int main(){
#ifdef LOCAL
freopen("input.txt","r",stdin);
#endif // LOCAL
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int t; cin >> t;
while (t--) {
int n, p; cin >> n >> p;
int c = generator(p);
vector <int> a(n);
vector <int> ap(p);
for (auto &e : a) cin >> e, ap[e] = 1;
sort(a.begin(), a.end());
if (a[0] == 0) {
if (n == 1) {
cout << p << " 1\n";
for (int i = 0; i < p; ++i) cout << i << ' ';
cout << '\n';
}
else {
vector <int> seq;
int curre = 1;
for (int i = 0; i < p - 1; ++i) seq.pb(curre), curre = (curre * c) % p;
bitset<N> up, down;
for (int i = 0; i < p - 1; ++i) {
if (ap[seq[i]]) down[p-1-i]=1;
}
for (int i = 0; i < p - 1; ++i) {
// cout << seq[i]<<'\n';
if (ap[seq[i]]) {
down[p-1]=0;
up[0]=1;
}
bt[seq[i]] = up|down;
up<<=1;
down<<=1;
// for (int j = 0; j < p; ++j) {
// if (bt[seq[i]][j]==1)cout<<1;
// else cout<<0;
// }
// cout<<'\n';
}
bitset<N> curr;
curr.set();
for (int i = 1; i <= p; ++i) {
if (i<p&&(curr & bt[i]).any()) {
curr &= bt[i];
}
else {
cout << curr.count() << ' ' << i << '\n';
vector <int> ans;
for (int j = 0; j < p; ++j) {
if (curr[j] == 1) ans.pb(seq[j]);
}
sort(ans.begin(), ans.end());
for (auto &e : ans) cout << e << ' ';
cout << '\n';
break;
}
// cout << i << endl;
}
}
}
else {
cout << "1 1\n0\n";
}
}
}
Details
/tmp/ccIdlBFQ.o: in function `_GLOBAL__sub_I_rng': answer.code:(.text.startup+0x1868): relocation truncated to fit: R_X86_64_PC32 against `.bss' answer.code:(.text.startup+0x1892): relocation truncated to fit: R_X86_64_PC32 against symbol `rng' defined in .bss section in /tmp/ccIdlBFQ.o answer.code:(.text.startup+0x18a6): relocation truncated to fit: R_X86_64_PC32 against symbol `rng' defined in .bss section in /tmp/ccIdlBFQ.o answer.code:(.text.startup+0x18c1): relocation truncated to fit: R_X86_64_PC32 against symbol `rng' defined in .bss section in /tmp/ccIdlBFQ.o answer.code:(.text.startup+0x19d1): relocation truncated to fit: R_X86_64_PC32 against symbol `rng' defined in .bss section in /tmp/ccIdlBFQ.o collect2: error: ld returned 1 exit status