QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#645802 | #6399. Classic: Classical Problem | crimsonsunset# | Compile Error | / | / | C++20 | 2.8kb | 2024-10-16 19:55:24 | 2024-10-16 19:55:27 |
Judging History
This is the latest submission verdict.
- [2024-10-16 19:55:27]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-10-16 19:55:24]
- Submitted
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define int ll
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
mt19937 rnd(1329);
int mod;
int fastpow(int a, int b) {
if (b == 0) return 1;
int t = fastpow(a, b / 2);
t = 1ll * t * t % mod;
if (b % 2) {
t = 1ll * t * a % mod;
}
return t;
}
int lol(int a) {
return 1 * fastpow(a, mod - 2);
}
bool used[(int)2e5 + 10];
void solve() {
int n, p;
cin >> n >> p;
mod = p;
vector<int> a(n);
for (int i = 0; i < n; ++i) cin >> a[i];
for (auto e : a) used[e] = 1;
if (used[0] == 0) {
// cout << "lol ";
cout << "1 1\n0\n";
for (auto e : a) used[e] = 0;
return;
}
sort(all(a));
if (n == 1) {
for (auto e : a) used[e] = 0;
cout << p << ' ' << 1 << '\n';
for (int i = 0; i < p; ++i) cout << i << ' ';
cout << '\n';
return;
}
int ans = 0;
while (used[ans]) ans++;
set<int> anss; anss.insert(1);
if (ans == 1) anss.insert(0);
vector<int> nota;
for (int i = 0; i < n - 1; ++i) for (int j = a[i]; j < a[i + 1]; ++j) nota.push_back(j);
for (int j = a[n - 1] + 1; j < p; ++j) nota.push_back(j);
vector<int> ord(p);
iota(all(ord), 0);
for (auto x : ord) {
if (x == 0) continue;
if (!used[1 * x]) continue;
bool ok = 1;
int x = lol(e);
// cout << x << '\n';
for (int i = 0; i < 300; ++i) {
if (ans == 1) break;
int j = rnd() % (ans - 1) + 1;
if (used[1ll * j * fastpow(x, mod - 2) % mod]) continue;
ok = 0;
break;
}
for (int i = 0; i < 300; ++i) {
if (ans == 1) break;
int j = nota[rnd() % (nota.size())];
if (j * x < ans) {
ok = 0;
break;
}
}
if (!ok) continue;
for (int j = 1; j < ans; ++j) {
if (used[1ll * j * fastpow(x, mod - 2) % mod]) continue;
ok = 0;
break;
}
if (!ok) continue;
if (ans == p) {
anss.insert(x);
continue;
}
if (used[1ll * ans * fastpow(x, mod - 2) % mod]) {
anss.clear();
while (ans < p && used[1ll * ans * fastpow(x, mod - 2) % mod]) ans++;
}
anss.insert(x);
}
cout << anss.size() << ' ' << ans << '\n';
for (auto e : anss) cout << e << ' '; cout << '\n';
for (auto e : a) used[e] = 0;
}
signed main() {
cin.tie(nullptr)->sync_with_stdio(false);
int t;
cin >> t;
while (t--) solve();
}
详细
answer.code: In function ‘void solve()’: answer.code:67:13: error: redeclaration of ‘ll x’ 67 | int x = lol(e); | ^ answer.code:63:15: note: ‘long long int x’ previously declared here 63 | for (auto x : ord) { | ^ answer.code:67:21: error: ‘e’ was not declared in this scope; did you mean ‘std::numbers::e’? 67 | int x = lol(e); | ^ | std::numbers::e In file included from /usr/include/c++/13/bits/max_size_type.h:37, from /usr/include/c++/13/bits/ranges_base.h:39, from /usr/include/c++/13/bits/ranges_algobase.h:38, from /usr/include/c++/13/bits/ranges_algo.h:38, from /usr/include/c++/13/algorithm:63, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51, from answer.code:1: /usr/include/c++/13/numbers:122:27: note: ‘std::numbers::e’ declared here 122 | inline constexpr double e = e_v<double>; | ^