QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#367315#8326. 最长待机quasar100 ✓1757ms128212kbC++237.2kb2024-03-25 21:02:272024-03-25 21:02:28

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 4
Accepted
time: 0ms
memory: 7940kb

input:

3 18
0 2 2 3
0 0
0 0
2 1
1 3
2 1
1 2
2 1
1 3
2 1
1 1
2 1
1 3
2 1
1 2
2 1
1 3
2 1
2 3
1 3
2 3

output:

3
3
3
1
2
2
2
1
1
1

result:

ok 10 lines

Test #2:

score: 4
Accepted
time: 1ms
memory: 5932kb

input:

3 24
0 1 2
0 1 3
0 0
2 1
1 3
2 1
1 2
2 1
1 3
2 1
1 1
2 1
1 3
2 1
1 2
2 1
1 3
2 1
2 2
2 3
1 2
2 2
1 3
2 2
2 3
1 2
2 2

output:

1
1
2
1
2
3
2
1
1
1
1
2
1
1

result:

ok 14 lines

Test #3:

score: 4
Accepted
time: 2ms
memory: 6048kb

input:

80 400
0 30 47 29 19 7 75 44 43 72 74 54 73 71 80 53 52 69 11 67 5 27 45 2 8 76 39 48 13 20 30 55
0 1 3
1 1 4
1 0
1 1 6
1 0
1 0
0 1 9
1 1 10
1 0
1 1 12
1 0
0 1 14
1 1 15
1 1 16
0 1 17
1 1 18
1 0
1 0
0 1 21
0 1 22
1 1 23
1 1 24
1 1 25
1 1 26
1 0
1 1 28
1 0
1 0
1 1 31
1 1 32
0 1 33
1 1 34
1 1 35
0 1 3...

output:

51
41
54
51
42
46
38
38
29
28

result:

ok 10 lines

Test #4:

score: 4
Accepted
time: 1ms
memory: 5916kb

input:

74 400
1 19 68 34 35 67 66 36 4 47 25 5 32 2 45 49 27 69 37 52 7
1 1 3
1 0
1 0
1 1 6
1 0
0 2 24 8
0 2 23 9
1 2 22 10
1 2 21 11
0 2 12 13
1 0
0 2 14 16
1 1 15
1 0
0 2 17 19
1 1 18
1 0
1 1 20
1 0
1 0
1 0
1 0
1 0
1 1 26
1 0
0 2 31 28
1 2 30 29
1 0
1 0
1 0
1 1 33
1 0
1 0
1 0
1 0
0 2 38 39
1 0
0 2 40 41
...

output:

5
6
7
8
7
7
6
7
7
8

result:

ok 10 lines

Test #5:

score: 4
Accepted
time: 2ms
memory: 5908kb

input:

72 400
0 20 57 56 45 69 44 70 66 63 71 67 20 64 42 46 54 58 36 48 22 2
1 2 3 4
1 0
0 2 19 5
0 2 18 6
0 2 17 7
1 2 16 8
1 2 14 9
0 2 12 10
1 1 11
1 0
1 1 13
1 0
1 1 15
1 0
1 0
1 0
1 0
1 0
1 1 21
1 0
0 2 23 24
1 0
1 2 35 25
0 2 26 27
1 0
0 2 34 28
1 2 29 31
1 1 30
1 0
1 2 32 33
1 0
1 0
1 0
1 0
1 2 37 ...

output:

31
32
24
31
28
26
24
26
29
27

result:

ok 10 lines

Test #6:

score: 4
Accepted
time: 1ms
memory: 5968kb

input:

67 400
0 18 32 8 9 5 55 15 30 39 13 6 56 66 10 2 33 58 41 16
0 2 4 3
1 0
1 0
1 0
1 1 7
1 0
1 0
1 0
0 2 11 12
1 0
1 0
1 1 14
1 0
1 0
0 2 29 17
0 2 28 18
0 2 27 19
0 2 20 21
1 0
0 2 26 22
1 2 23 24
1 0
1 1 25
1 0
1 0
1 0
1 0
1 0
1 1 31
1 0
1 0
1 2 34 35
1 0
1 2 38 36
1 1 37
1 0
1 0
1 1 40
1 0
1 2 54 4...

output:

28
29
24
25
26
24
22
22
20
20

result:

ok 10 lines

Test #7:

score: 4
Accepted
time: 991ms
memory: 78164kb

input:

299997 100000
0 38184 118418 160031 39613 64145 21447 82313 153472 194278 233911 260519 258547 179800 123643 155852 243698 159500 299047 223811 272402 136698 109561 161859 111161 112378 165711 53726 282621 75666 255477 282389 55704 280472 55425 233602 218175 244840 95970 191178 280530 288983 198006 ...

output:

44420
46196
45388
45486
47779
47336
47951
48336
48463
47101

result:

ok 10 lines

Test #8:

score: 4
Accepted
time: 1227ms
memory: 89116kb

input:

297435 100000
1 16526 169231 31311 209138 72173 31544 87162 174354 194768 6830 11261 193059 123216 263515 242044 150839 134155 60672 267046 42765 2691 65047 6343 282710 32889 10897 123195 53143 190179 70554 180723 206333 153841 86954 69387 135466 115260 263612 282558 30596 50382 27315 232391 266702 ...

output:

453
623
780
928
1004
1077
1132
1192
1230
1265

result:

ok 10 lines

Test #9:

score: 4
Accepted
time: 1223ms
memory: 91284kb

input:

296430 100000
0 16509 164044 128949 5791 8328 191172 270257 2067 123946 79551 29910 163884 286170 85317 218639 43485 165509 55880 11284 52574 172745 292104 197421 90695 73587 193366 150977 8744 178336 186535 167094 125269 172592 198643 194271 95635 7185 18675 268586 283249 151228 270397 144339 15126...

output:

19038
19419
19864
20273
20685
20904
21269
21460
21737
21761

result:

ok 10 lines

Test #10:

score: 4
Accepted
time: 1278ms
memory: 91912kb

input:

297355 100000
0 16529 116965 95696 132349 139205 263653 116821 245376 17711 50109 86327 88216 70633 87010 213452 296564 96672 3081 133016 263291 290792 261497 279816 68273 18433 161420 265352 161411 80417 280629 89199 264543 88034 271970 92178 7985 95836 75048 241543 140042 177334 175855 231551 1170...

output:

18969
19692
20167
20594
20793
21316
21563
21741
22006
22123

result:

ok 10 lines

Test #11:

score: 4
Accepted
time: 795ms
memory: 82668kb

input:

299997 100000
0 38184 121549 237125 187135 44840 175329 289196 48679 231685 102744 98629 169517 148740 71882 299237 203491 222417 76214 187695 295318 193490 146867 226342 208502 10470 73221 172469 194532 216136 83785 158844 267090 256376 16937 270909 105085 155557 187670 107313 128960 190931 134537 ...

output:

27142
27142
27142
27143
27143
27143
27143
27143
27143
27143
27143
27143
27143
27143
27143
27143
27143
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
27142
...

result:

ok 50000 lines

Test #12:

score: 4
Accepted
time: 638ms
memory: 76404kb

input:

300000 100000
1 2 2 3
1 2 4 5
0 2 6 7
0 2 8 9
0 2 10 11
0 2 12 13
0 2 14 15
0 2 16 17
0 2 18 19
0 2 20 21
0 2 22 23
1 2 24 25
1 2 26 27
0 2 28 29
0 2 30 31
1 2 32 33
0 2 34 35
1 2 36 37
1 2 38 39
1 2 40 41
0 2 42 43
0 2 44 45
0 2 46 47
0 2 48 49
1 2 50 51
0 2 52 53
0 2 54 55
0 2 56 57
0 2 58 59
1 2 ...

output:

16
16
10
16
10
15
16
12
16
15
16
16
12
9
6
16
15
15
15
16
12
16
16
13
8
12
15
13
16
5
14
16
15
16
16
15
16
10
15
16
16
12
14
11
12
15
16
15
16
16
16
14
8
10
16
13
8
4
12
16
12
13
16
15
15
5
16
14
14
16
8
14
8
16
16
11
13
14
16
15
16
16
9
10
16
16
16
16
11
16
15
15
13
14
14
15
16
16
11
16
14
9
16
16
...

result:

ok 50000 lines

Test #13:

score: 4
Accepted
time: 833ms
memory: 79700kb

input:

296865 100000
1 16401 225035 267708 83216 250911 130508 174427 90766 209839 10836 224234 265090 266168 128610 173024 25687 94612 275885 270012 270492 256270 99172 204430 268325 264603 41561 247616 100145 223718 282580 130374 268515 264725 271118 270168 105169 167720 9203 132524 245080 202503 47306 2...

output:

1506
879
552
1481
1196
678
593
1511
1171
1297
1503
793
1116
1516
1128
1126
194
1608
493
1496
459
872
764
497
834
660
356
732
938
741
467
1598
270
262
1118
644
402
895
1211
555
215
1596
981
1552
1230
1608
242
1608
136
1411
1608
1370
1205
290
227
1608
556
431
296
1133
964
884
1081
1608
501
794
446
784...

result:

ok 50000 lines

Test #14:

score: 4
Accepted
time: 363ms
memory: 64664kb

input:

300000 100000
0 2 2 3
0 2 4 5
0 2 6 7
0 2 8 9
0 2 10 11
0 2 12 13
0 2 14 15
0 2 16 17
0 2 18 19
0 2 20 21
0 2 22 23
0 2 24 25
0 2 26 27
0 2 28 29
0 2 30 31
0 2 32 33
0 2 34 35
0 2 36 37
0 2 38 39
0 2 40 41
0 2 42 43
0 2 44 45
0 2 46 47
0 2 48 49
0 2 50 51
0 2 52 53
0 2 54 55
0 2 56 57
0 2 58 59
0 2 ...

output:

16385
143080
143080
458
49329
114864
36716
16385
111713
10544
10546
85542
85543
257
85542
65534
20010
85542
65
26860
26860
26861
4097
26861
6851
26862
26862
6851
26862
26862
20012
25168
25168
5157
20013
25169
20014
129
25170
3951
9463
25171
8192
2049
23264
23265
18109
23264
23181
23180
23180
5155
51...

result:

ok 60000 lines

Test #15:

score: 4
Accepted
time: 374ms
memory: 64660kb

input:

300000 100000
0 2 2 3
0 2 4 5
0 2 6 7
0 2 8 9
0 2 10 11
0 2 12 13
0 2 14 15
0 2 16 17
0 2 18 19
0 2 20 21
0 2 22 23
0 2 24 25
0 2 26 27
0 2 28 29
0 2 30 31
0 2 32 33
0 2 34 35
0 2 36 37
0 2 38 39
0 2 40 41
0 2 42 43
0 2 44 45
0 2 46 47
0 2 48 49
0 2 50 51
0 2 52 53
0 2 54 55
0 2 56 57
0 2 58 59
0 2 ...

output:

143081
65536
143080
49790
124788
124788
8193
8192
124788
257
41754
107287
32289
32290
107287
16383
41756
107287
95377
65531
95376
513
29847
95376
2048
8192
94336
65529
1025
94336
28416
65527
93942
28416
18950
75968
16710
2562
66995
2545
2049
66996
9465
1432
62824
62825
24247
62824
7246
14772
62824
3...

result:

ok 60000 lines

Test #16:

score: 4
Accepted
time: 920ms
memory: 90576kb

input:

296395 100000
0 16457 245999 266544 118474 208222 282365 209509 60267 295991 22618 63285 283634 257368 189173 95631 202618 153471 127167 179466 153112 233380 159436 21354 226143 208452 38569 290639 203237 292809 70083 240199 196176 202662 12053 179437 293049 4398 292886 100359 128426 78879 47183 195...

output:

18194
1442
18194
430
18194
1062
18194
680
18194
290
18194
2954
18194
971
18194
324
18194
259
18194
904
18194
909
18194
73
18194
212
18194
3303
18194
494
18194
2464
18194
458
18194
633
18194
506
18195
231
18195
596
18195
2272
18195
76
18195
318
18196
846
18196
1024
18196
257
18197
628
18197
790
18197...

result:

ok 66667 lines

Test #17:

score: 4
Accepted
time: 904ms
memory: 90900kb

input:

296708 100000
0 16512 21589 18093 191770 288996 4587 266062 139389 20240 156912 162652 217536 292716 215234 165877 149995 151531 1156 3098 150143 274667 121566 185544 124328 180420 121857 144221 244490 169296 12767 145607 160946 140231 181230 251832 52333 74284 119763 27390 20069 218534 117114 16511...

output:

18550
268
18550
450
18550
311
18550
2710
18550
480
18550
670
18550
511
18550
386
18550
1143
18550
386
18550
761
18550
288
18550
294
18550
252
18551
386
18551
579
18551
605
18550
292
18550
455
18550
481
18550
267
18550
253
18550
461
18550
594
18550
474
18550
210
18551
481
18551
224
18551
294
18551
60...

result:

ok 66667 lines

Test #18:

score: 4
Accepted
time: 1571ms
memory: 113980kb

input:

500000 200000
0 59992 351497 270706 187144 450426 159821 46325 370061 245238 280914 155637 3024 346798 232026 86214 379276 47651 152396 107095 308816 452986 80885 493878 19743 152548 345282 131577 297631 228091 383867 434161 110585 334955 429217 385207 407172 237222 234882 301917 17678 314366 59573 ...

output:

40515
40515
40515
40514
40514
40514
40514
40514
40514
40514
40514
40514
40514
40514
40513
40514
40514
40514
40514
40514
40517
40517
40517
40517
40517
40517
40518
40518
40518
40518
40518
40522
40522
40522
40522
40523
40523
40496
40496
40496
40496
40496
40496
40496
40496
40496
40496
40496
40496
40496
...

result:

ok 100000 lines

Test #19:

score: 4
Accepted
time: 1588ms
memory: 114804kb

input:

500000 200000
0 59992 295645 321125 105773 362180 51671 373790 351130 240019 248952 168146 270340 482516 35451 272279 364481 458953 115388 123004 180465 87438 462193 85574 185505 286434 110732 47583 488543 311138 262117 295312 431387 486387 344563 284151 499940 219880 193483 484482 313871 105158 359...

output:

37748
37748
37749
37749
37749
37749
37749
37749
37749
37749
37749
37749
37749
37749
37749
37749
37749
37749
37749
37752
37750
37750
37750
37749
37749
37749
37749
37750
37750
37750
37750
37750
37750
37750
37750
37750
37749
37749
37749
37666
37666
37666
37666
37666
37667
37667
37667
37667
37667
37667
...

result:

ok 100000 lines

Test #20:

score: 4
Accepted
time: 1240ms
memory: 104084kb

input:

500000 200000
1 2 2 3
0 2 4 5
0 2 6 7
1 2 8 9
1 2 10 11
1 2 12 13
0 2 14 15
1 2 16 17
0 2 18 19
1 2 20 21
1 2 22 23
1 2 24 25
1 2 26 27
1 2 28 29
0 2 30 31
0 2 32 33
0 2 34 35
0 2 36 37
1 2 38 39
0 2 40 41
0 2 42 43
1 2 44 45
0 2 46 47
0 2 48 49
0 2 50 51
1 2 52 53
0 2 54 55
0 2 56 57
1 2 58 59
1 2 ...

output:

17
18
18
18
18
14
18
11
13
9
14
3
18
6
18
17
16
18
18
18
7
4
16
17
18
18
14
10
6
4
18
16
5
18
17
18
13
18
11
18
17
14
18
9
16
18
15
9
17
18
16
17
18
18
14
18
18
16
18
12
18
17
16
17
11
14
18
18
16
18
18
18
8
18
7
18
17
13
18
17
18
17
14
18
10
17
18
18
17
18
9
17
13
3
18
17
15
18
13
18
15
18
14
11
17...

result:

ok 100000 lines

Test #21:

score: 4
Accepted
time: 1687ms
memory: 108488kb

input:

492559 200000
1 25782 382871 376920 141723 14970 345596 25870 469147 224653 76277 440258 333963 207508 282884 357870 43231 420716 220814 299633 143430 256443 309321 434278 323103 345412 299536 3428 185168 71308 206814 63344 334281 298536 470977 151572 413254 65222 362944 10581 281501 435502 402658 6...

output:

1445
1916
1161
640
1199
532
1795
964
1171
2278
2229
342
258
984
2024
678
366
1014
682
1624
945
244
1583
746
2171
1988
155
2218
1751
1226
1244
640
443
1208
690
2431
2279
1357
749
1488
1388
1165
2430
1851
1114
945
1745
1316
966
720
1219
1706
2430
411
1482
221
1669
502
1348
1270
1309
286
1865
1258
2429...

result:

ok 100000 lines

Test #22:

score: 4
Accepted
time: 756ms
memory: 84024kb

input:

500000 200000
0 2 2 3
0 2 4 5
0 2 6 7
0 2 8 9
0 2 10 11
0 2 12 13
0 2 14 15
0 2 16 17
0 2 18 19
0 2 20 21
0 2 22 23
0 2 24 25
0 2 26 27
0 2 28 29
0 2 30 31
0 2 32 33
0 2 34 35
0 2 36 37
0 2 38 39
0 2 40 41
0 2 42 43
0 2 44 45
0 2 46 47
0 2 48 49
0 2 50 51
0 2 52 53
0 2 54 55
0 2 56 57
0 2 58 59
0 2 ...

output:

118929
118929
125000
125001
65535
125000
65535
125000
125000
8193
15983
15983
33
15983
15983
15983
15983
15983
32769
24205
15983
15983
2049
15983
16383
5560
15983
24208
24208
15983
15983
129
15983
24206
15983
15983
15983
4095
15983
2049
7572
15983
8190
2049
15983
15983
15983
15983
15983
513
15983
15...

result:

ok 120000 lines

Test #23:

score: 4
Accepted
time: 743ms
memory: 86000kb

input:

500000 200000
0 2 2 3
0 2 4 5
0 2 6 7
0 2 8 9
0 2 10 11
0 2 12 13
0 2 14 15
0 2 16 17
0 2 18 19
0 2 20 21
0 2 22 23
0 2 24 25
0 2 26 27
0 2 28 29
0 2 30 31
0 2 32 33
0 2 34 35
0 2 36 37
0 2 38 39
0 2 40 41
0 2 42 43
0 2 44 45
0 2 46 47
0 2 48 49
0 2 50 51
0 2 52 53
0 2 54 55
0 2 56 57
0 2 58 59
0 2 ...

output:

8193
32769
233544
190332
513
190331
6080
6080
125005
32769
41315
41315
6080
8
41315
41316
4097
41316
10
53391
41317
17
32769
41317
41318
20623
41317
6085
16385
41318
32769
41318
41318
8193
257
41318
35232
16382
41318
41319
20623
41318
41319
257
41319
41320
41319
41319
33
41320
41320
1260
3954
41321
...

result:

ok 120000 lines

Test #24:

score: 4
Accepted
time: 1757ms
memory: 128212kb

input:

492987 200000
0 25938 142618 463168 428660 248822 271630 273835 357795 263553 158934 44379 146321 271516 118230 147842 357992 53655 126296 115610 431656 470724 382910 61766 6663 230277 1606 202467 20246 333875 147752 71202 67107 263747 305677 279244 257206 241502 374240 360375 282253 328372 374430 3...

output:

28473
187
28473
249
28473
491
28473
831
28474
465
28474
1171
28474
187
28474
1842
28474
627
28474
683
28474
519
28474
290
28474
337
28474
764
28474
3764
28474
201
28474
411
28474
321
28474
757
28474
1030
28474
1475
28474
312
28474
840
28474
633
28474
1102
28474
299
28474
730
28474
335
28474
189
2847...

result:

ok 133334 lines

Test #25:

score: 4
Accepted
time: 1743ms
memory: 127528kb

input:

493584 200000
0 25883 460521 120530 18353 58696 49521 285612 118781 55363 55403 235052 263485 338922 4370 24752 10042 386398 311324 439788 57031 129544 431944 353528 493010 187336 269902 270837 290686 433628 342004 137002 129733 456393 474762 312293 179263 269927 432986 188725 483680 301460 105083 3...

output:

28734
1142
28734
739
28734
299
28734
2824
28734
718
28734
393
28734
244
28734
322
28734
878
28734
28734
28734
1065
28734
1098
28734
631
28734
41
28734
837
28734
544
28734
787
28734
1195
28734
277
28734
1172
28734
861
28734
362
28734
851
28734
793
28734
397
28734
623
28734
699
28735
377
28735
951
287...

result:

ok 133334 lines