QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#61698#4830. Transfer of Dutyyanran0 12ms7552kbC++14678b2022-11-14 16:22:242023-02-13 21:57:17

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-13 21:57:17]
  • 评测
  • 测评结果:0
  • 用时:12ms
  • 内存:7552kb
  • [2022-11-14 16:22:24]
  • 提交

answer

#include <bits/stdc++.h>
#define IOS\
	ios::sync_with_stdio(false);\
	cin.tie(0), cout.tie(0);

using namespace std;

const int N = 1e6 + 3;

int a[N], n, h1, h2;
char ch[10];

signed main() {
	srand(time(0));
	mt19937 mt(114514);
	IOS;
	for (int i = 1; i < N; i++) {
		a[i] = mt();
	}
//	cout << a[483440] << '\n';
	cin >> ch;
	if (ch[0] == 'r') {
		cin >> h1 >> h2;
	}
	cin >> n;
	for (int i = 1, x; i <= n; i++) {
		cin >> x;
		h1 ^= x;
		h2 ^= a[x];
		if (!h1 && !h2) {
			cout << "0\n";
		}
		else if (a[h1] == h2) {
			cout << h1 << '\n';
		}
		else cout << "-1\n";
	}
	if (ch[0] == 's') cout << h1 << " " << h2 << '\n';
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 11ms
memory: 7292kb

input:

start
5
10
14
10
12
10

output:

10
-1
14
-1
-1
8 -379904591

input:

resume
8 -379904591
6
14
277
12
10
277
12

output:

-1
-1
-1
277
0
12

result:

ok 

Test #2:

score: 100
Accepted
time: 11ms
memory: 7552kb

input:

start
1
1

output:

1
1 -1341078317

input:

resume
1 -1341078317
1
1

output:

0

result:

ok 

Test #3:

score: 100
Accepted
time: 8ms
memory: 7496kb

input:

start
1
1000000

output:

1000000
1000000 234262076

input:

resume
1000000 234262076
2
1
1000000

output:

-1
1

result:

ok 

Test #4:

score: 100
Accepted
time: 5ms
memory: 7500kb

input:

start
2
1
1

output:

1
0
0 0

input:

resume
0 0
2
1000000
1000000

output:

1000000
0

result:

ok 

Test #5:

score: 100
Accepted
time: 12ms
memory: 7336kb

input:

start
3
1
2
3

output:

1
-1
-1
0 -830220605

input:

resume
0 -830220605
2
4
5

output:

-1
-1

result:

ok 

Test #6:

score: 0
Stage 1: Program answer Runtime Error

input:

start
5
483440
800458
959493
679027
187008

output:


input:


output:


result: