QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#87001#4830. Transfer of Dutyxixike0 395ms53560kbC++14873b2023-03-11 15:56:462023-03-11 15:56:50

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 15:56:50]
  • 评测
  • 测评结果:0
  • 用时:395ms
  • 内存:53560kb
  • [2023-03-11 15:56:46]
  • 提交

answer

#include <bits/stdc++.h>
#define ull unsigned long long

using namespace std;

const int N = 1e6 + 10;
int seed;
string s;
int n, m;
ull hs[N], now;
unordered_map <ull, int> mp;

inline void solve(ull now){
	mt19937 rnd(seed);
	n = 1e6; ull sum = 0;
	for(int i = 1; i < n; ++i)	hs[i] = rnd(), mp[hs[i]] = i, sum ^= hs[i];
	hs[n] = sum, mp[sum] = n;
	cin >> m;
//	cout << "???  " << sum << endl;
	sum = now;
	for(int i = 1; i <= m; ++i){
		int x; cin >> x;
		sum ^= hs[x];
		if(!sum) cout << "0\n";
		else if(mp.count(sum)) cout << mp[sum] << '\n';
		else cout << "-1\n";
	}
	if(now == 0) cout << seed << " " << sum << '\n';
}


signed main(){
	cin >> s;
	if(s == "start") return seed = 20060707, solve(0), 0;
	else return cin >> seed >> now, solve(now), 0;
}
//3851686081
/*
resume
20060707 3986479849
6
14
277
12
10
277
12
*/

详细

Test #1:

score: 100
Accepted
time: 341ms
memory: 53536kb

input:

start
5
10
14
10
12
10

output:

10
-1
14
-1
-1
20060707 3986479849

input:

resume
20060707 3986479849
6
14
277
12
10
277
12

output:

-1
-1
-1
277
0
12

result:

ok 

Test #2:

score: 100
Accepted
time: 351ms
memory: 53560kb

input:

start
1
1

output:

1
20060707 2550767503

input:

resume
20060707 2550767503
1
1

output:

0

result:

ok 

Test #3:

score: 100
Accepted
time: 387ms
memory: 53308kb

input:

start
1
1000000

output:

1000000
20060707 2528353153

input:

resume
20060707 2528353153
2
1
1000000

output:

-1
1

result:

ok 

Test #4:

score: 100
Accepted
time: 388ms
memory: 53528kb

input:

start
2
1
1

output:

1
0
20060707 0

input:

resume
20060707 0
2
1000000
1000000

output:

1000000
0
20060707 0

result:

ok 

Test #5:

score: 100
Accepted
time: 380ms
memory: 53500kb

input:

start
3
1
2
3

output:

1
-1
-1
20060707 1277712460

input:

resume
20060707 1277712460
2
4
5

output:

-1
-1

result:

ok 

Test #6:

score: 100
Accepted
time: 367ms
memory: 53412kb

input:

start
5
483440
800458
959493
679027
187008

output:

483440
-1
-1
-1
-1
20060707 3052275818

input:

resume
20060707 3052275818
8
312653
808184
244728
372836
64144
525068
795548
379152

output:

-1
-1
-1
-1
-1
-1
-1
-1

result:

ok 

Test #7:

score: 100
Accepted
time: 395ms
memory: 53456kb

input:

start
68
901287
581649
963302
839936
728540
414441
916931
567596
695928
364562
839701
726560
34000
85414
129234
413159
976576
799600
479209
808330
182632
685443
41419
207533
762418
206283
144088
679114
945142
919478
220106
992468
483248
197576
129732
123083
987094
712824
650777
907335
206313
958433
...

output:

901287
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
20060707 1492880639

input:

resume
20060707 1492880639
68
632048
873503
23659
234350
352724
63249
395634
638205
597162
368489
973286
290734
735407
636099
145516
176166
262275
936624
302002
344028
227364
297307
645242
206861
471059
139081
861346
172592
637220
698174
593758
561280
324011
489640
497542
657953
82088
553578
102675
...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1

result:

ok 

Test #8:

score: 100
Accepted
time: 369ms
memory: 53456kb

input:

start
520
569396
440938
116732
473751
47601
877390
277114
259139
437475
193896
992342
402838
838349
33699
536576
163847
117713
927965
598864
939506
517156
87428
943725
624835
515205
108250
468405
990560
512040
343417
101050
944099
177534
73824
476709
772630
489775
929453
216227
822538
552185
208923
...

output:

569396
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:

resume
20060707 3395658045
700
707366
267047
407693
725807
896458
649723
322966
13478
797908
8465
563163
798321
831358
235782
473564
19913
929601
720398
521831
221253
936397
987947
63596
47475
259147
560605
188477
743888
948782
654739
934236
341826
67525
197899
989556
144568
618026
850867
550036
482...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #9:

score: 0
Wrong Answer on the first run

input:

start
8443
729060
666260
185101
382196
371654
40175
191745
696848
627288
695514
463530
357409
465277
741772
43361
979762
952428
178423
841409
405526
498821
973165
335585
375002
113423
365239
404592
237309
573524
962229
36036
696295
373438
251803
891072
633659
62534
157262
573215
610136
499209
762268...

output:

729060
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1...

input:


output:


result:

wrong answer wrong answer on the first run, query 8153: read 102698 but expected -1