QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#86922#4830. Transfer of DutyIgnotus0 11ms11348kbC++14915b2023-03-11 14:50:472023-03-11 14:50:59

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-11 14:50:59]
  • 评测
  • 测评结果:0
  • 用时:11ms
  • 内存:11348kb
  • [2023-03-11 14:50:47]
  • 提交

answer

#include <bits/stdc++.h>

using ull = unsigned long long;
const int N = 1e6 + 10;

std::mt19937_64 rng(41);
std::string oper;

ull a[N], xsum, xid;

int n;
void Anya(){
	std::cin >> n;
	for(int i = 1, x; i <= n; ++i){
		std::cin >> x;
		xsum ^= a[x], xid ^= x;
		if(!xsum && !xid) std::cout << "0\n";
		else if(xid < N & a[xid] == xsum) std::cout << xid << '\n';
		else std::cout << "-1\n";
	}
	std::cout << xsum << " " << xid << '\n';
}

void Andrei(){
	std::cin >> xsum >> xid;
	std::cin >> n;
	for(int i = 1, x; i <= n; ++i){
		std::cin >> x;
		xsum ^= a[x], xid ^= x;
		if(!xsum && !xid) std::cout << "0\n";
		else if(xid < N & a[xid] == xsum) std::cout << xid << '\n';
		else std::cout << "-1\n";
	}
}

int main(){
	std::ios::sync_with_stdio(false);
	std::cin >> oper;
	for(int i = 1; i < N; ++i) a[i] = rng();
	if(oper == "start") Anya();
	else Andrei();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

start
5
10
14
10
12
10

output:

10
-1
14
-1
-1
9111532157656318823 8

input:

resume
9111532157656318823 8
6
14
277
12
10
277
12

output:

-1
-1
-1
277
0
12

result:

ok 

Test #2:

score: 100
Accepted
time: 7ms
memory: 11172kb

input:

start
1
1

output:

1
15926475875848578451 1

input:

resume
15926475875848578451 1
1
1

output:

0

result:

ok 

Test #3:

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

input:

start
1
1000000

output:

1000000
2177766039474956394 1000000

input:

resume
2177766039474956394 1000000
2
1
1000000

output:

-1
1

result:

ok 

Test #4:

score: 100
Accepted
time: 10ms
memory: 11192kb

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: 11ms
memory: 11348kb

input:

start
3
1
2
3

output:

1
-1
-1
7100605798830919018 0

input:

resume
7100605798830919018 0
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:

483440
-1
-1

input:


output:


result: