QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#295355#4830. Transfer of Dutyucup-team2660#0 687ms81520kbC++201.8kb2023-12-31 03:33:552023-12-31 03:33:56

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 666ms
memory: 81520kb

input:

start
5
10
14
10
12
10

output:

10
-1
14
-1
-1
60157 154452

input:

resume
60157 154452
6
14
277
12
10
277
12

output:

-1
-1
-1
277
0
12

result:

ok 

Test #2:

score: 100
Accepted
time: 624ms
memory: 81444kb

input:

start
1
1

output:

1
287579 930040

input:

resume
287579 930040
1
1

output:

0

result:

ok 

Test #3:

score: 100
Accepted
time: 595ms
memory: 81448kb

input:

start
1
1000000

output:

1000000
324482 757912

input:

resume
324482 757912
2
1
1000000

output:

-1
1

result:

ok 

Test #4:

score: 100
Accepted
time: 603ms
memory: 81256kb

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: 625ms
memory: 81348kb

input:

start
3
1
2
3

output:

1
-1
-1
362927 270574

input:

resume
362927 270574
2
4
5

output:

-1
-1

result:

ok 

Test #6:

score: 100
Accepted
time: 621ms
memory: 81424kb

input:

start
5
483440
800458
959493
679027
187008

output:

483440
-1
-1
-1
-1
795663 423488

input:

resume
795663 423488
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: 621ms
memory: 81312kb

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
283125 187364

input:

resume
283125 187364
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
32329
...

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: 610ms
memory: 81276kb

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
792099 759787
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
48216
288...

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: 100
Accepted
time: 598ms
memory: 81340kb

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:

resume
559068 815410
9886
420210
520488
188197
748478
206087
275961
54195
608381
155537
321018
415228
668078
924461
161132
119676
879347
707167
899509
348680
459789
490439
773296
166145
740279
863122
581710
69615
444211
182480
543538
452479
284383
565588
539092
957001
22888
230633
56687
403989
34627...

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 #10:

score: 100
Accepted
time: 680ms
memory: 81352kb

input:

start
95751
308697
772166
788484
646333
666534
92445
786509
646923
836713
476019
699260
122853
518658
556909
839126
518374
192398
728985
64716
176986
975947
644795
748557
310350
187984
204486
401437
532833
615053
995384
580446
107265
183547
188255
578145
852736
311107
298993
513464
829086
302554
710...

output:

308697
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-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
53453 267734
84366
27218
701633
132961
472984
701389
698190
669373
935077
378738
192191
77653
557125
650845
266909
475045
934661
119608
959584
788489
234755
596450
958580
223648
245932
228632
187317
851898
217174
209683
723661
866509
294070
291163
75492
341391
949271
525339
449996
649502
1913...

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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kb

input:

start
99880
1
11
7
14
7
9
7
4
4
8
9
6
8
12
3
11
4
14
1
12
12
11
9
10
6
3
12
8
8
11
7
11
1
11
11
14
4
8
1
14
14
4
3
7
13
3
3
8
6
14
12
3
14
8
14
3
5
7
6
6
7
2
11
13
1
10
2
6
4
11
3
1
7
10
14
14
5
8
3
14
2
6
4
3
9
3
11
5
4
11
7
5
5
7
2
5
14
5
7
11
11
10
11
2
6
11
5
12
11
10
13
8
12
4
9
9
12
6
10
7
6
1...

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
-...

input:

resume
184095 430645
99990
7
14
2
14
8
2
4
10
9
6
13
2
4
3
12
9
8
13
14
6
2
7
9
1
9
13
3
9
14
9
3
7
11
2
2
6
6
3
10
9
9
10
1
5
6
14
6
12
3
6
4
8
12
12
5
11
1
13
7
5
11
7
13
4
5
9
7
13
2
12
5
10
13
4
14
1
5
11
12
9
2
6
14
4
8
8
11
6
8
6
11
12
9
4
3
2
1
13
10
12
2
13
12
12
3
10
10
10
12
3
5
13
10
2
5
...

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 #16:

score: 100
Accepted
time: 687ms
memory: 81348kb

input:

start
100000
394129
918049
227627
394129
227627
918049
730034
886281
958919
958919
730034
886281
108051
279991
756917
982336
982336
756917
620015
643225
671990
498572
965213
784067
302045
302045
448973
284292
498572
549214
671990
643225
646142
108051
598249
784067
315666
448973
695438
965213
620015
...

output:

394129
-1
-1
-1
918049
0
730034
-1
-1
-1
886281
0
108051
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
279991
0
149638
-1
149638
0
953158
-1
546431
-1
-1
-1
273407
-1
-1
-1
273407
0
555339
0
654326
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-...

input:

resume
587682 905308
99998
929652
263139
663517
929652
696025
692392
138617
898592
906009
898592
906009
352125
138617
38059
383093
621629
662423
692392
4770
809970
907768
573182
742492
523142
414423
242561
621629
294780
358106
696025
376843
505429
185628
358106
573182
505429
587177
587177
278968
663...

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
523142
-1
82886
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
647066
-1
254973
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 

Test #17:

score: 0
Wrong Answer on the first run

input:

start
99999
947665
127760
350354
669358
625042
583671
697219
193704
575165
512223
530130
575165
858585
999857
546323
127760
391941
697219
706174
947665
187941
698085
583671
544095
462885
530130
544095
706174
318321
669358
999857
421347
512223
858585
350354
49865
187941
755625
546323
625042
698085
19...

output:

947665
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
391941
0
660927
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-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 82701: read 632291 but expected -1