QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#455418#105. Simple gameMaMengQi100 ✓53ms30684kbC++231.4kb2024-06-26 13:48:162024-06-26 13:48:16

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 22
Accepted

Test #1:

score: 22
Accepted
time: 2ms
memory: 13824kb

input:

3 3
1 5 1
2 3
1 1 5
2 3

output:

2
1

result:

ok 2 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 28632kb

input:

1000 1000
403944 539844 451514 488113 693733 651613 563358 916918 605393 909558 657949 170748 659971 389016 826009 517990 412996 904989 357541 151208 802899 615350 245323 574670 586084 779493 509446 634227 113180 158403 598536 396554 496919 395067 849333 498457 288483 246925 615590 137465 97346 5881...

output:

444
462
34
516
288
400
438
492
100
515
268
514
446
456
216
442
510
204
512
276
236
454
264
102
186
428
62
470
505
242
364
519
158
238
298
300
178
108
252
514
166
84
424
334
506
410
382
208
212
446
517
224
384
274
42
342
514
464
348
192
150
342
126
186
495
442
290
508
464
450
510
505
491
440
194
62
5...

result:

ok 500 lines

Test #3:

score: 0
Accepted
time: 2ms
memory: 28760kb

input:

1000 1000
487368 55984 456259 117591 818795 130390 526829 133610 539549 246445 951093 697788 460061 958553 20524 222803 693422 185251 755559 448153 90840 763128 128640 416349 932645 865509 827859 26384 827493 458273 309250 649929 806506 371204 684146 836161 123213 444296 235532 894872 313447 206287 ...

output:

440
400
480
130
38
388
404
489
428
485
318
218
352
480
476
168
178
486
438
478
260
483
482
378
230
164
194
174
340
104
476
312
486
46
36
126
100
264
248
98
316
296
230
310
424
300
490
422
467
70
422
390
298
34
474
332
481
426
308
488
320
72
110
354
235
78
323
440
262
229
489
280
457
388
404
397
222
...

result:

ok 500 lines

Test #4:

score: 0
Accepted
time: 0ms
memory: 28356kb

input:

1000 1000
570792 604828 236813 971260 135345 576462 298812 284894 506408 550627 211533 257531 227447 784987 990847 670720 165337 657002 186281 488202 154588 943609 236149 323436 246502 208422 922081 708141 317613 533952 828477 160199 181501 314636 518959 206569 957942 674371 822770 428086 786444 791...

output:

386
460
50
470
126
26
468
384
146
519
310
20
450
56
482
150
416
338
144
412
360
390
434
468
204
414
330
510
486
514
304
472
322
2
521
418
246
460
196
513
514
400
450
288
198
519
110
414
204
316
158
198
194
250
452
282
468
106
454
138
414
368
34
144
514
308
505
162
472
424
500
114
442
14
502
514
106
...

result:

ok 500 lines

Test #5:

score: 0
Accepted
time: 0ms
memory: 28208kb

input:

1000 1000
686920 120969 241559 600738 484598 279431 103500 501586 473268 854809 471972 560379 60241 354524 185362 118637 445763 904560 617004 785147 218337 867195 343659 389307 560359 551334 16302 133002 31925 768414 347703 446278 491088 290772 288364 833874 792672 871742 410007 218197 2545 185620 4...

output:

330
306
418
290
136
340
224
84
426
418
324
461
290
276
278
434
494
186
214
72
370
434
430
424
228
427
422
126
314
104
398
388
326
314
114
422
362
477
412
102
270
465
334
282
506
10
258
392
450
394
427
382
124
451
240
124
344
256
518
512
108
510
308
4
198
386
426
222
254
508
512
24
90
326
494
294
394...

result:

ok 500 lines

Test #6:

score: 0
Accepted
time: 0ms
memory: 29152kb

input:

1000 1000
737640 478325 54816 262919 609660 758208 66971 909766 407423 126288 732412 152827 860332 180957 155685 566554 693485 376310 47726 49387 506277 14973 451168 263690 874216 637350 110523 525159 746238 68284 91121 956548 576484 234205 347369 171578 660106 101817 997245 975604 410133 803734 209...

output:

230
418
148
338
4
441
510
186
387
212
318
418
184
482
118
510
278
418
500
480
406
464
130
82
246
198
497
461
355
288
112
431
521
491
495
493
451
501
395
499
176
519
118
112
343
427
497
509
178
469
509
234
78
513
491
134
305
517
481
291
345
411
338
194
509
493
160
491
469
118
497
395
305
499
377
305
...

result:

ok 500 lines

Test #7:

score: 0
Accepted
time: 0ms
memory: 20096kb

input:

1000 1000
1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 ...

output:

999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
999
...

result:

ok 1000 lines

Subtask #2:

score: 27
Accepted

Test #8:

score: 27
Accepted
time: 28ms
memory: 15772kb

input:

100000 100000
18 15 8 5 7 19 19 11 11 8 6 15 11 8 15 12 6 16 18 18 16 17 20 18 18 17 15 5 8 8 18 6 18 20 14 19 19 5 9 16 5 17 15 19 20 17 12 9 14 18 19 16 9 6 10 11 13 16 12 18 6 12 6 15 19 20 10 17 10 12 15 13 18 7 14 8 7 15 7 14 9 17 10 15 13 14 15 12 11 12 14 14 14 19 7 16 7 17 12 16 11 6 18 18 1...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #9:

score: 0
Accepted
time: 53ms
memory: 24932kb

input:

100000 100000
611680 625326 848926 304761 34686 696982 275897 392063 769779 97648 477956 908326 678227 975305 324587 445989 114055 568928 232496 23720 819209 270123 89065 357324 169130 404179 130496 333348 773133 109363 144114 336567 194409 437469 655441 966463 892042 498325 192834 391531 219600 734...

output:

30636
30745
50130
4464
9086
47043
41334
49040
49968
40968
45913
30688
38855
840
48754
6896
41115
2658
35926
17394
31093
38693
45522
42447
47342
25584
926
21204
48506
48938
44596
32697
29204
28487
9200
49694
14140
11356
31722
50040
45009
26502
43711
18410
32269
9824
48842
22450
49066
22264
45987
2302...

result:

ok 100000 lines

Test #10:

score: 0
Accepted
time: 47ms
memory: 27208kb

input:

100000 100000
695104 174171 853672 901534 351235 175759 47881 576051 769342 369127 705691 435366 478318 544842 551806 926611 361778 816486 695922 287961 882958 193709 196575 231707 482987 779795 192013 15105 487445 152337 663340 846837 536700 380901 424846 561063 726771 728400 780072 924745 435700 3...

output:

31870
39772
30788
11144
42732
17872
33875
15158
36182
45316
47798
30266
12804
45814
21926
30490
3204
20580
49888
15958
46132
43824
3100
50130
21818
32766
42471
22490
14726
33583
50216
39287
24618
50220
41716
46026
48282
41428
28186
1282
23618
45394
42254
156
34109
42294
43432
21176
45942
46726
32973...

result:

ok 100000 lines

Test #11:

score: 0
Accepted
time: 33ms
memory: 15932kb

input:

100000 100000
1 1 1 2 1 1 2 1 2 2 1 2 2 1 1 2 1 1 2 1 2 1 2 2 1 2 1 2 2 2 2 1 1 2 2 1 2 2 2 2 2 2 1 1 2 1 1 1 2 2 1 2 1 2 1 1 2 1 2 1 2 1 1 2 2 1 2 2 1 1 2 2 1 2 1 1 1 1 2 1 2 1 1 1 1 2 2 1 1 1 2 2 1 1 1 2 2 1 1 2 1 1 2 2 2 1 2 2 1 2 2 1 2 1 1 2 1 1 2 1 1 2 1 2 2 2 2 2 1 2 1 1 1 1 1 2 2 2 2 2 2 1 2 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #12:

score: 0
Accepted
time: 33ms
memory: 13864kb

input:

100000 100000
2845 22894 4105 11830 29440 21804 24593 9910 14938 21157 24268 10418 9470 15050 3826 9948 15110 14592 2236 15211 2172 24929 9640 25051 26304 5194 15624 28298 19336 20491 5587 17181 7787 23690 1267 8073 19782 1376 9046 11722 1623 14250 9310 5279 26997 18041 19681 8475 22437 22562 5529 2...

output:

45066
50090
24109
27778
294
44422
34690
49640
48910
27841
40956
45154
44522
48806
32334
34736
21047
6908
22098
23527
32756
46746
44044
43216
13954
5816
28681
50068
7090
48558
21855
49224
7510
22323
16208
17085
33148
7880
48952
29166
17741
45728
19435
39960
49368
48080
47020
49508
3548
4476
48654
268...

result:

ok 100000 lines

Subtask #3:

score: 51
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #13:

score: 51
Accepted
time: 51ms
memory: 30684kb

input:

100000 100000
123269 247698 241557 639404 387765 948914 460495 251584 959303 613156 222329 886960 433508 798929 160485 522976 927783 189816 503897 354632 527266 322665 831249 741938 98777 7947 372156 306688 452421 81111 713914 866403 371410 522650 218788 140965 323553 371639 362820 15073 133319 1591...

output:

37412
1520
46224
964
50058
46256
44458
22714
29000
30024
48378
46802
44502
27732
37086
46506
22429
32076
11058
31676
2330
35672
37032
50042
48246
49290
45714
50072
50070
42896
50028
5580
7258
47536
26260
638
14122
26538
31704
35260
22311
49770
31434
22890
35176
15648
49964
43850
3634
7614
42754
3885...

result:

ok 50000 lines

Test #14:

score: 0
Accepted
time: 51ms
memory: 27080kb

input:

100000 100000
206693 572351 22110 493074 737019 394987 232478 435572 958867 917338 482768 446704 200894 433874 322296 3597 465105 661566 901916 651576 815206 470443 938759 840513 412634 350859 433673 731549 166733 380981 233140 119778 713701 466083 20897 544077 190987 634418 917353 580991 606316 777...

output:

33086
49042
43971
17756
41889
49882
9886
19628
24632
47410
23996
39425
3250
40735
49584
38791
7476
47274
49984
12998
36335
16126
44223
43412
49074
572
48508
29876
49204
49906
46690
12568
31506
2432
34040
11508
12604
19744
47180
31510
2842
17808
22444
44388
5864
34971
23924
45429
28738
8234
13134
315...

result:

ok 50000 lines

Test #15:

score: 0
Accepted
time: 51ms
memory: 28752kb

input:

100000 100000
322821 121195 59560 155256 829377 97956 4462 652264 893022 221520 743208 749552 33688 227604 259915 451514 712828 941828 299934 691625 878955 618220 854780 714897 726491 661067 527894 156409 848341 680851 976559 662752 799096 442219 855710 105973 993013 831789 537295 305694 789713 1711...

output:

28252
45031
28212
6208
31642
49764
28954
49674
37738
49822
45891
29018
46880
47188
19194
49308
14938
24672
13868
48412
1996
44422
26268
47976
49340
47100
15160
12462
37850
46978
33892
37342
47452
36044
23884
29072
34594
6328
28730
49646
49640
27976
29914
25972
6334
25648
40716
49136
26006
48176
4902...

result:

ok 50000 lines

Test #16:

score: 0
Accepted
time: 50ms
memory: 29128kb

input:

100000 100000
438949 637336 872818 784733 178630 609437 33341 803548 827178 525703 3648 309295 609587 829845 262942 899431 184742 189386 730656 955866 975407 541806 962289 556576 297244 747084 589411 838166 371166 948018 463081 948831 108683 352947 882010 476382 860446 61864 124533 95805 230005 7565...

output:

45374
22320
9690
5630
40012
9752
49932
48275
25818
14324
3050
24416
29638
8482
47591
49954
49772
10946
28032
29100
14766
42784
30260
24924
48274
49696
48068
49922
43112
49930
49942
30150
49323
48630
23512
45864
9214
48077
29116
4450
27696
31278
26176
33670
39824
47836
49934
49756
21624
10066
44298
4...

result:

ok 50000 lines

Test #17:

score: 0
Accepted
time: 50ms
memory: 28720kb

input:

100000 100000
489669 186180 653371 446915 527884 55509 772620 20240 794037 829885 72599 836335 409677 623574 424753 347348 432465 693841 128674 28619 263348 689584 37095 430959 643805 89996 683632 230323 85478 247888 206499 426397 483678 329084 716823 103686 695176 259235 711770 629019 478810 374701...

output:

43104
43128
41430
35554
996
46482
49604
49326
3642
32348
48852
42408
46742
45082
28544
10650
45034
42692
39452
3546
47352
18858
39108
13432
46578
30716
38440
11556
10260
14608
23730
15220
45686
2588
45032
44820
49956
21464
23778
11880
22870
26516
49054
41208
49242
45356
31126
2596
47138
46694
42156
...

result:

ok 50000 lines

Test #18:

score: 0
Accepted
time: 46ms
memory: 22016kb

input:

100000 100000
1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000000 1 1000...

output:

99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
99999
...

result:

ok 100000 lines