QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#212449 | #7522. Sequence Shift | sinsop90 | WA | 1ms | 5740kb | C++20 | 859b | 2023-10-13 16:02:01 | 2023-10-13 16:02:01 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
int n, q, W = 1000000000, b[maxn], ans[maxn], lasans;
struct ASK {
int w, id;
}Q[maxn];
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cin >> n >> q;
for(int i = 1;i <= n;i++) cin >> Q[i].w, Q[i].id = i;
sort(Q + 1, Q + 1 + n, [](ASK a, ASK b) {return a.w > b.w;});
int T = W / sqrt(n);
for(int i = 1, x;i <= n + q;i++) {
cin >> b[i];
b[i] ^= lasans;
for(int j = 1;j <= n;j++) {
if(Q[j].w + b[i] < W - 2 * T) break;
int id = i - Q[j].id + 1;
if(id > n) ans[id] = max(ans[id], Q[j].w + b[i]);
}
if(i < n) continue;
if(ans[i - n + 1] < W - 2 * T) {
for(int j = 1;j <= n;j++) ans[i - n + 1] = max(ans[i - n + 1], Q[j].w + b[i - n + Q[j].id]);
}
lasans = ans[i - n + 1];
cout << ans[i - n + 1] << '\n';
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 5740kb
input:
5 3 1 4 3 2 5 7 5 8 3 2 3 6 4
output:
11 13 16 25
result:
ok 4 lines
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 5716kb
input:
1 0 103509429 823330096
output:
0
result:
wrong answer 1st lines differ - expected: '926839525', found: '0'