QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#61692#4830. Transfer of Dutyyanran0 2ms3592kbC++14647b2022-11-14 16:17:562023-02-13 21:57:10

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:10]
  • 评测
  • 测评结果:0
  • 用时:2ms
  • 内存:3592kb
  • [2022-11-14 16:17:56]
  • 提交

answer

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

using namespace std;

const int N = 100 + 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();
	}
	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;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3592kb

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: 2ms
memory: 3416kb

input:

start
1
1

output:

1
1 -1341078317

input:

resume
1 -1341078317
1
1

output:

0

result:

ok 

Test #3:

score: 0
Stage 1: Program answer Runtime Error

input:

start
1
1000000

output:


input:


output:


result: