QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#212473#7522. Sequence Shiftsinsop90WA 1ms5728kbC++20953b2023-10-13 16:18:212023-10-13 16:18:21

Judging History

你现在查看的是最新测评结果

  • [2023-10-13 16:18:21]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5728kb
  • [2023-10-13 16:18:21]
  • 提交

answer

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
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 - T) break;
			int id = i - Q[j].id + 1;
			if(id >= 1 && id <= q) ans[id] = max(ans[id], Q[j].w + b[i]);
		}
		if(i < n) continue;
//		cout << ans[i - n + 1] << " " << W - 2 * T << endl;
		if(ans[i - n + 1] <  W - 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';
	}
} 

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 5728kb

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: 1ms
memory: 5708kb

input:

1 0
103509429
823330096

output:

0

result:

wrong answer 1st lines differ - expected: '926839525', found: '0'