QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#695477 | #9426. Relearn through Review | Charlie983 | Compile Error | / | / | C++14 | 864b | 2024-10-31 20:06:39 | 2024-10-31 20:07:34 |
Judging History
This is the latest submission verdict.
- [2024-10-31 20:07:34]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2024-10-31 20:06:39]
- Submitted
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
const int N = 1e6 + 10,M=210;
const int inf=0x3f3f3f3f,mod=998244353;
void solve() {
int n,k;
cin>>n>>k;
vector<int> a(n + 1);
for (int i = 1; i <= n; i++) {
cin>>a[i];
}
vector<int> pre(n + 1), suf(n + 2);
for (int i = 1; i <= n; i++) {
pre[i] = std::__gcd(pre[i - 1], a[i]);
}
for (int i = n; i >= 1; i--) {
suf[i] = std::__gcd(suf[i + 1], a[i]);
}
int ans = pre[n];
for (int i = 1; i <= n; i++) {
if (pre[i] == pre[i - 1]) continue;
int g = 0;
for (int j = i; j <= n; j++) {
g = std::__gcd(g, a[j] + k);
ans = max(ans, std::__gcd(pre[i - 1], std::__gcd(g, suf[j + 1])));
}
}
cout << ans << '\n';
}
Details
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/13/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x24): undefined reference to `main' collect2: error: ld returned 1 exit status