QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#731328#5478. Quiz ContestgymRE 1717ms116016kbC++204.1kb2024-11-10 02:11:022024-11-10 02:11:03

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 9696kb

input:

2 4
2 2
1 2

output:

20
4

result:

ok 2 lines

Test #2:

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

input:

4 6
1 1 2 2
1 1 1 2

output:

168
168
336
48

result:

ok 4 lines

Test #3:

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

input:

4 82
20 22 12 28
20 22 7 8

output:

746371221
528486621
148054814
913602744

result:

ok 4 lines

Test #4:

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

input:

2 2
1 1
1 1

output:

1
1

result:

ok 2 lines

Test #5:

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

input:

1 1
1
1

output:

1

result:

ok single line: '1'

Test #6:

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

input:

1 2
2
1

output:

2

result:

ok single line: '2'

Test #7:

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

input:

2 5
2 3
2 1

output:

12
108

result:

ok 2 lines

Test #8:

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

input:

3 6
3 1 2
3 1 2

output:

108
420
192

result:

ok 3 lines

Test #9:

score: 0
Accepted
time: 3ms
memory: 9804kb

input:

10 181
21 11 1 38 33 31 2 25 17 2
13 9 1 37 26 16 2 4 13 2

output:

933670175
947389273
127286706
932736158
827765819
807282126
45553639
228256557
350039760
45553639

result:

ok 10 lines

Test #10:

score: 0
Accepted
time: 3ms
memory: 9692kb

input:

9 141
47 11 1 53 2 3 1 1 22
30 1 1 40 1 2 1 1 4

output:

959854830
649008360
59000760
9143465
118001520
42136705
59000760
59000760
221770152

result:

ok 9 lines

Test #11:

score: 0
Accepted
time: 3ms
memory: 10032kb

input:

6 167
40 2 1 54 43 27
31 2 1 14 37 18

output:

21684914
968181716
594826171
452099065
231748717
716046725

result:

ok 6 lines

Test #12:

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

input:

18 166
5 1 14 6 12 12 1 5 12 9 1 16 12 7 13 17 5 18
5 1 2 5 1 2 1 1 8 9 1 14 9 1 13 9 5 17

output:

424073779
982729592
570450467
984062217
812067221
258146602
982729592
920670548
515287508
879372936
982729592
802466756
124165180
889641026
888797216
227029638
424073779
310377834

result:

ok 18 lines

Test #13:

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

input:

8 152
50 16 54 13 1 6 11 1
19 4 24 13 1 2 2 1

output:

877632556
241460682
91908033
969346444
96488448
124488250
658149142
96488448

result:

ok 8 lines

Test #14:

score: 0
Accepted
time: 105ms
memory: 12824kb

input:

146 32696
368 65 173 10 276 370 47 358 412 456 4 78 196 420 311 52 268 30 299 442 350 381 129 256 165 368 178 23 374 197 375 16 85 292 243 252 119 365 229 139 149 4 6 131 357 160 73 457 314 157 47 240 451 103 72 216 225 2 348 75 122 120 215 431 324 390 290 201 152 397 41 456 160 59 95 222 427 366 12...

output:

467990629
463000266
943072509
432089030
49032918
611725131
153142050
344818177
77750674
577573890
168930682
784177123
289251676
359922539
792694167
6087427
525005617
82895478
85438974
681066466
186956527
334880899
244523308
287659908
691939081
470665184
582502913
222544676
12306392
202576806
6796758...

result:

ok 146 lines

Test #15:

score: 0
Accepted
time: 265ms
memory: 27216kb

input:

12 135502
445 7 74 7828 3973 88981 2 3 34020 6 14 149
296 1 44 2077 1410 58906 2 2 20274 5 8 97

output:

247771824
547131421
646713541
586476213
655944584
292156217
450970619
631309320
381265997
891057017
213293851
155903656

result:

ok 12 lines

Test #16:

score: 0
Accepted
time: 595ms
memory: 44888kb

input:

34 191157
12849 385 7417 5645 3650 14937 5263 14239 6748 8 5559 7584 6916 7862 10048 7 4440 12669 14879 6 1578 1 11033 64 1013 832 4689 14222 85 55 9369 4830 2220 55
4207 162 5105 4482 3092 12838 4290 1343 1237 8 538 3464 4374 1541 6650 3 2080 10969 5545 2 954 1 5674 32 224 35 4297 12964 23 46 1233 ...

output:

255119209
521376107
197752736
442383424
832357744
455431749
949816103
213054433
580939700
62100482
889645036
129669655
386246248
79884619
472922214
913181203
438817794
983088203
944477001
334844558
742360339
456376198
73581656
572167147
590992793
24664993
595551147
589468590
415150968
757752443
5798...

result:

ok 34 lines

Test #17:

score: 0
Accepted
time: 668ms
memory: 43200kb

input:

70 182517
2435 152 2917 21 5364 4056 4106 5062 2452 4938 1581 5477 1575 5258 422 5017 1811 1668 44 5138 4822 1548 1555 1471 1001 3030 2262 3634 2448 2756 5574 3013 73 403 1760 23 2761 5568 958 816 3233 529 1771 290 1668 3227 2 3198 3489 5689 733 354 5524 5196 413 1298 1691 887 5305 1514 3315 2556 55...

output:

713670549
493984929
786459236
608057522
777911712
678950818
645324064
464695978
588897470
704643687
1308082
951095374
545178848
759655092
867183769
314404297
655634891
311057797
687724076
165666906
408580851
249765524
147179956
908049799
624378594
724558870
249141772
899676450
694659492
215347473
90...

result:

ok 70 lines

Test #18:

score: 0
Accepted
time: 110ms
memory: 18292kb

input:

15 55966
18 15004 226 815 2 19930 8 11437 1 144 11 722 7050 346 252
8 4263 219 763 1 15689 2 1379 1 96 9 595 5354 195 24

output:

791239607
202491784
333152928
35656281
54347292
560275242
570958010
418598684
27173646
343462640
566313512
813564902
257035400
163734689
302743685

result:

ok 15 lines

Test #19:

score: 0
Accepted
time: 1304ms
memory: 67460kb

input:

22255 200000
11 17 12 16 15 16 7 8 14 1 14 2 4 9 4 10 8 2 12 11 4 3 7 11 17 3 6 11 6 1 8 15 10 4 12 10 4 15 4 1 13 17 11 8 17 6 13 17 13 8 11 6 8 6 14 6 9 10 5 6 13 17 1 12 9 9 10 5 6 9 13 5 15 13 9 7 5 15 13 15 4 14 7 15 13 15 8 12 2 8 15 7 3 5 2 1 12 10 10 5 3 10 13 7 3 15 10 10 14 12 17 11 2 11 7...

output:

69559751
808437681
100585574
738741835
889199547
432436383
510370369
276255019
920483510
358122725
716691199
716245450
361736339
94711106
274950112
553797515
824450201
716245450
819554809
240123194
434246547
610842079
866994073
240123194
217553094
716480897
425641462
883724571
151389184
358122725
82...

result:

ok 22255 lines

Test #20:

score: 0
Accepted
time: 1368ms
memory: 71972kb

input:

36420 200000
5 7 10 1 5 6 3 10 2 1 5 3 10 1 4 7 6 6 6 5 2 6 1 2 1 9 3 8 6 3 6 3 4 1 2 1 10 5 4 9 9 6 10 6 10 10 7 8 8 7 1 1 5 3 2 5 2 2 5 2 8 6 10 1 5 5 5 8 10 2 1 5 9 6 9 9 9 1 2 8 3 3 9 2 3 9 7 9 1 3 2 1 8 2 4 10 2 6 10 6 8 6 7 7 2 10 7 7 6 9 7 2 8 3 2 8 2 3 7 10 6 4 6 9 7 4 6 8 1 9 2 7 1 1 10 6 1...

output:

874289995
621495883
205883960
20588396
940210486
56206057
741362761
148099876
653357481
20588396
102941980
741362761
372216136
20588396
634483960
722917888
56206057
775075279
775075279
940210486
653357481
775075279
20588396
653357481
20588396
200084624
741362761
709543793
775075279
810358506
5620605...

result:

ok 36420 lines

Test #21:

score: 0
Accepted
time: 1365ms
memory: 73860kb

input:

36319 200000
10 4 1 9 1 8 1 8 10 5 6 7 6 9 2 3 3 6 1 3 3 2 1 9 5 7 6 10 10 4 8 1 9 4 6 2 1 1 3 8 4 1 6 6 8 10 10 8 4 3 10 6 3 6 7 3 9 8 9 2 5 2 8 10 2 7 8 6 1 4 1 10 3 10 2 5 6 4 4 1 8 8 6 10 3 7 9 4 10 4 6 9 7 10 10 4 6 2 8 6 1 9 7 6 9 2 1 9 8 4 6 6 6 9 10 8 8 7 5 7 7 9 6 3 8 5 10 4 3 10 4 3 8 3 8 ...

output:

145039298
613892710
467714607
480222591
467714607
354332976
467714607
641269354
847878096
944159307
809798936
102881528
809798936
344738136
116646544
751420855
404899468
769024819
467714607
404899468
404899468
116646544
467714607
344738136
207440160
505531342
832714316
621022796
684168658
872614075
...

result:

ok 36319 lines

Test #22:

score: 0
Accepted
time: 1295ms
memory: 65900kb

input:

23699 200000
5 4 11 1 12 1 12 14 8 7 13 16 6 10 2 11 2 7 13 11 7 2 5 14 4 3 10 11 12 2 9 13 7 10 11 3 3 5 16 11 13 6 3 5 3 16 1 3 5 8 10 3 15 12 14 13 16 2 5 14 14 14 4 3 9 13 4 10 14 2 3 2 14 3 8 12 8 9 1 2 3 1 5 11 15 8 10 11 13 8 15 8 12 12 11 10 12 12 5 14 4 7 7 12 11 5 1 10 6 6 11 2 1 11 1 7 10...

output:

97753678
94654465
806698707
772346881
730460505
772346881
932078316
619951417
849163904
751313953
58065923
223698068
797395891
397935970
319319014
876243146
319319014
415206402
30897448
806698707
348590580
319319014
97753678
830412804
986231975
19875470
359443064
478707065
641719462
319319014
622440...

result:

ok 23699 lines

Test #23:

score: 0
Accepted
time: 1307ms
memory: 65716kb

input:

23450 200000
16 9 12 15 13 3 2 13 4 12 15 7 7 11 13 14 8 14 9 11 15 9 13 15 8 8 11 10 14 7 5 7 15 10 8 4 1 9 7 3 3 10 10 1 9 14 16 4 11 15 4 5 3 5 11 15 7 4 15 15 16 16 13 1 15 2 4 14 4 4 9 16 14 11 2 10 4 2 15 4 8 16 13 10 5 13 12 5 13 5 9 1 3 6 12 3 9 4 15 2 10 15 4 8 10 16 15 9 5 11 8 6 6 11 3 5 ...

output:

474695859
83419528
920048071
608644925
770244720
629045727
687229624
770244720
47173846
130400332
227663296
891887483
408814978
509883448
421840108
158963017
201344505
639339650
747874550
571257479
163000415
874702347
506445097
814520699
513020117
364643511
48624719
134635290
422587572
891887483
497...

result:

ok 23450 lines

Test #24:

score: 0
Accepted
time: 1159ms
memory: 57760kb

input:

4849 200000
8 22 59 79 71 28 80 1 3 33 61 13 23 26 24 46 81 49 67 74 61 31 60 16 64 6 12 57 80 42 54 79 23 42 57 69 39 6 27 22 23 23 5 7 29 52 37 7 77 23 20 51 40 43 37 29 48 6 4 27 6 68 14 81 2 35 60 57 47 10 80 56 60 33 74 54 22 79 35 5 62 77 16 10 17 61 68 46 75 67 30 50 28 3 65 50 3 77 14 52 70 ...

output:

738820305
995662070
515212393
798390516
605493806
489891780
979096941
151234509
762638378
909212435
444617296
574181489
353579321
532058270
323704777
391854489
42906050
223642089
277062806
356648099
394850400
400862577
953806751
410434779
798854700
123706455
922706931
638349308
765280510
616250553
7...

result:

ok 4849 lines

Test #25:

score: 0
Accepted
time: 1247ms
memory: 61184kb

input:

13856 200000
17 10 3 24 24 21 6 25 18 16 2 13 27 1 10 12 17 28 10 8 18 18 10 1 24 7 6 14 9 3 14 8 3 9 17 26 13 13 26 26 14 23 15 21 1 28 4 17 13 15 11 11 18 6 17 7 4 3 28 9 15 9 14 7 8 24 24 13 25 26 4 5 16 10 10 15 1 2 28 6 24 16 3 3 25 11 19 2 15 15 24 24 11 12 28 10 6 6 19 23 6 3 22 28 28 25 6 11...

output:

72511455
336078483
861680851
720077183
790671089
31284384
338206945
548013067
371508861
820204542
15903041
365379610
767417188
619975068
833896416
702488592
45692271
974866446
865334783
354070115
598285710
136389867
140082053
619975068
424549074
423559809
530690398
963536392
588553847
633502040
9675...

result:

ok 13856 lines

Test #26:

score: 0
Accepted
time: 1152ms
memory: 57028kb

input:

4876 200000
41 11 35 16 22 55 37 81 41 8 23 38 67 77 42 51 62 40 46 66 69 49 14 49 39 51 18 68 2 71 17 48 58 48 79 77 35 29 68 46 35 41 7 63 23 46 51 67 55 22 15 29 78 30 19 14 39 19 59 7 11 19 7 10 56 1 61 75 69 72 46 27 63 21 50 74 68 47 41 18 32 81 74 76 53 68 37 73 71 56 81 1 47 71 51 3 8 79 37 ...

output:

194802687
711557866
419124213
801265297
48436835
950559282
233655583
499574348
632401673
991182010
338343298
163975865
190059859
984431152
623842274
475987266
583639129
520065554
812017554
778651338
217224836
860424934
580393239
960485163
480680434
126018786
913299905
326963209
225193463
862288369
6...

result:

ok 4876 lines

Test #27:

score: 0
Accepted
time: 1192ms
memory: 58868kb

input:

7858 200000
50 49 11 30 21 8 21 41 9 47 37 25 27 25 30 26 48 33 46 29 44 29 48 19 29 11 39 50 6 36 40 3 19 3 13 6 40 31 12 27 38 15 1 3 30 30 1 31 26 2 23 47 24 20 15 31 38 47 18 37 9 10 48 1 7 22 20 18 48 17 45 23 18 2 40 9 30 27 40 19 25 12 23 23 17 33 34 27 8 12 23 18 46 9 24 29 21 14 18 45 44 44...

output:

54810749
584922225
793707623
879467423
66593011
913860155
320787318
286251410
548807590
148590789
894585923
630093969
355604779
698475619
276417708
962780761
116431688
553760434
365980953
814281703
362919744
423908461
347257826
915023838
13017917
690490068
477632454
509652288
150184662
599297079
650...

result:

ok 7858 lines

Test #28:

score: 0
Accepted
time: 1176ms
memory: 57952kb

input:

4838 200000
9 54 21 58 64 63 33 69 66 47 67 81 36 19 46 11 47 17 61 30 17 20 13 58 59 35 7 46 47 14 65 13 29 10 70 34 64 22 56 7 9 44 46 81 35 75 73 43 74 22 44 47 13 64 10 37 22 75 34 77 43 38 74 68 60 9 25 38 70 64 42 27 11 32 58 40 66 73 17 74 37 34 68 31 35 62 52 17 38 48 27 10 64 62 15 47 74 49...

output:

645185483
622967370
289161025
306400723
979912384
908394448
363934537
568938416
326383729
966772202
533234569
603850548
450161784
516419054
717028836
64940288
181374970
158340511
917802460
991584826
462339263
857686540
865733565
191708153
19657223
898049460
3957153
777271552
707985381
575857338
9067...

result:

ok 4838 lines

Test #29:

score: 0
Accepted
time: 1107ms
memory: 54412kb

input:

3560 200000
40 77 41 16 71 76 63 8 57 71 81 75 24 63 64 69 60 77 13 77 58 27 69 67 56 51 72 37 74 57 52 74 81 71 34 78 66 75 82 53 77 72 70 68 59 33 72 17 78 53 75 57 66 41 75 55 81 35 35 20 60 28 18 81 80 79 52 11 61 78 54 51 11 42 46 59 44 20 54 73 47 73 76 68 65 67 48 63 76 64 61 47 52 78 58 84 2...

output:

639342443
198672513
971133352
214282708
897022340
114809355
240809550
50548157
361737808
681922286
819373461
683145827
420417845
401522113
484747086
360277328
322184118
554462045
596143679
380194003
664901568
411976069
141459105
440736578
751443261
147111544
966140114
555174856
704695283
150952089
4...

result:

ok 3560 lines

Test #30:

score: 0
Accepted
time: 1128ms
memory: 56544kb

input:

3499 200000
69 36 66 84 24 58 57 27 75 61 66 58 29 65 71 53 40 19 45 52 61 37 47 9 58 80 38 19 82 29 78 83 77 52 83 70 84 73 72 48 71 45 54 29 59 13 61 49 52 68 41 86 57 25 60 42 81 73 14 72 46 47 82 57 84 75 18 40 44 68 43 17 62 50 71 43 40 74 70 43 76 81 12 53 75 32 62 83 81 69 84 23 78 84 39 60 5...

output:

360581401
640000198
820634207
600896941
329746358
340253042
355170039
785937036
343769588
706520059
469119705
106961591
375336648
359462212
635198866
743323557
960991553
10455676
520127658
578057863
774780901
563099109
662318230
206404119
94049948
212681249
39453515
385309736
216845689
92912465
9035...

result:

ok 3499 lines

Test #31:

score: 0
Accepted
time: 1126ms
memory: 56332kb

input:

3456 200000
40 77 50 31 29 58 49 82 80 51 77 37 78 69 82 59 63 52 31 58 68 28 52 70 63 82 80 44 84 71 75 19 73 67 59 57 46 84 28 84 85 43 52 43 60 79 37 79 79 87 86 78 76 77 60 67 3 66 87 42 64 56 78 50 72 83 80 78 50 34 77 42 68 47 75 78 70 80 36 57 55 84 82 60 8 23 81 82 37 83 66 36 70 44 41 86 78...

output:

556970143
480987945
309202035
847640377
373024785
971359770
403684577
783601789
635848140
286443977
48644093
96767085
616670163
850462203
490709242
169885611
931050764
822827125
739988693
497920179
982771711
93030947
674656894
837109200
968480432
793355079
371882564
378033744
364370258
221288258
956...

result:

ok 3456 lines

Test #32:

score: 0
Accepted
time: 1146ms
memory: 54220kb

input:

3346 200000
78 72 40 55 50 68 46 56 54 88 73 23 84 69 82 48 35 83 13 66 62 47 84 89 64 55 86 69 44 86 63 60 17 27 59 67 69 80 62 81 77 56 69 74 14 70 27 65 65 63 39 82 31 46 51 67 55 88 88 75 77 53 39 76 74 88 47 49 43 43 44 76 63 39 62 82 71 66 59 60 79 76 46 73 54 54 89 37 38 63 73 19 61 79 87 56 ...

output:

25363556
79569849
454817830
713113379
633456860
120115916
693903370
389293808
23735906
255199558
92206911
791196042
438571210
537868342
808000544
684774763
350861838
102632212
643073038
980259549
527450570
176074308
803557862
756694781
72076739
778441811
577602132
74783737
723678800
912569543
570162...

result:

ok 3346 lines

Test #33:

score: 0
Accepted
time: 1134ms
memory: 55988kb

input:

3036 200000
99 69 78 52 96 63 28 98 28 79 93 51 25 94 84 70 43 75 70 27 98 89 77 46 83 70 28 93 34 92 95 17 93 63 84 58 76 49 82 68 45 49 94 48 90 96 12 41 68 90 93 65 49 31 54 44 71 69 64 40 20 92 64 64 57 16 52 79 91 53 42 70 94 36 44 88 78 72 68 93 99 45 95 22 21 54 80 96 26 32 46 56 79 84 94 95 ...

output:

714328546
972486345
931992547
456632958
528659274
78863140
37681550
494659405
45532344
898693523
876553133
796759948
24133339
551847022
37278092
279265337
522279862
36200770
596798979
429965208
32711736
854059266
442606609
169181257
613777468
742705370
768304849
956320038
625532542
667494093
4611937...

result:

ok 3036 lines

Test #34:

score: 0
Accepted
time: 1470ms
memory: 67724kb

input:

1627 200000
54 30 52 51 8 44 56 16 49 53 37 34 15 42 33 55 25 32 36 53 53 47 40 23 51 41 32 43 36 37 43 19 37 8 55 46 15 29 39 32 45 13 13 12 52 56 32 36 42 39 52 48 33 40 48 34 44 28 40 13 38 15 20 54 50 42 31 45 11 43 5 55 38 40 54 39 56 49 28 36 48 35 28 47 38 2 50 56 37 23 14 22 33 42 55 45 57 1...

output:

837419063
809581635
92748162
284241332
948918933
12093512
892102876
719816556
547095
722354711
445511729
458970757
466134227
790960911
679477162
816689674
734297163
772017914
267216904
263067810
223716040
114860559
539075683
632752961
863386648
251745353
58262647
925718397
539640013
791606432
763439...

result:

ok 1627 lines

Test #35:

score: 0
Accepted
time: 1052ms
memory: 60216kb

input:

1927 200000
55 37 61 8 47 43 46 21 30 60 42 10 34 54 50 47 43 11 36 57 58 21 55 44 45 39 19 10 43 47 63 61 42 32 20 48 21 45 31 57 53 51 39 37 24 56 17 49 59 34 62 58 55 27 45 61 35 47 59 54 26 43 23 48 20 21 34 51 56 5 13 53 56 54 54 53 47 35 13 50 55 30 53 49 33 31 63 43 59 55 14 47 15 24 39 28 56...

output:

113209086
833768309
445991310
556139015
898449322
395681434
939915504
372301378
683396122
105741269
737587853
755542807
574858869
834163747
884352687
790640695
886494430
815888577
696888977
262307754
227976454
236279765
549157567
821861211
337605994
469475960
321666990
411461665
570392936
629650248
...

result:

ok 1927 lines

Test #36:

score: 0
Accepted
time: 1077ms
memory: 59328kb

input:

2032 200000
47 45 53 50 51 55 63 50 52 47 29 60 32 44 37 61 65 62 39 30 53 33 23 62 56 57 59 44 45 9 63 47 54 33 39 59 31 49 45 23 57 58 47 46 27 30 55 64 21 13 44 55 55 55 7 60 62 54 60 64 52 34 36 29 55 38 25 12 64 44 18 46 57 44 47 16 45 21 42 47 53 41 39 60 49 62 61 18 19 12 37 51 50 62 14 61 59...

output:

405875945
44106826
573364854
561016491
486939391
463341587
548927691
54792645
618144616
377217603
431352067
759319397
245021603
208445840
179978239
124207361
258224392
118856306
124499208
885165662
978850539
545179549
669051828
727844040
850572944
567931004
114699750
801115123
142565459
83064041
894...

result:

ok 2032 lines

Test #37:

score: 0
Accepted
time: 1421ms
memory: 65572kb

input:

1606 200000
21 21 30 47 53 27 40 57 46 42 58 27 35 59 54 54 22 57 22 44 30 25 21 52 57 50 5 21 27 56 45 56 19 46 27 10 53 56 35 50 28 25 51 55 56 41 40 54 53 12 56 23 49 36 5 41 47 46 23 33 49 55 42 56 25 26 46 57 23 42 6 49 4 54 25 9 37 57 42 52 21 50 41 21 36 56 57 28 25 23 23 22 49 51 39 25 41 55...

output:

344144240
698504731
318323751
422142382
956574068
795427986
132941038
827812002
210310447
488564276
19222018
33811633
424930379
882729733
437939418
559723612
713084756
461721305
908295251
809458812
596793842
532407261
126108254
115920490
658591950
488805549
78140418
31255145
145468100
196541438
7740...

result:

ok 1606 lines

Test #38:

score: 0
Accepted
time: 1046ms
memory: 55588kb

input:

2602 200000
33 46 87 27 54 45 79 69 36 73 27 76 71 61 87 73 53 61 75 58 90 86 45 51 58 58 61 50 51 33 88 71 30 84 48 81 87 86 79 36 60 49 69 45 66 86 86 65 37 76 17 75 72 76 79 19 26 32 26 39 89 77 45 83 60 21 41 87 56 60 63 48 86 67 54 89 31 54 86 66 46 74 83 25 51 49 79 16 69 74 84 91 28 55 4 40 5...

output:

585416664
550574362
733086624
497630036
330086337
17213093
772867410
684869101
853246438
904634677
917724551
445828435
141165709
782378776
625712385
328670522
506623921
528107584
859257071
106473582
112704625
692252942
625802135
818384788
537026321
68521654
363973189
367228095
342246196
385521900
23...

result:

ok 2602 lines

Test #39:

score: 0
Accepted
time: 1280ms
memory: 63704kb

input:

18534 200000
7 8 4 10 12 6 6 9 8 11 5 8 6 9 2 3 3 4 4 3 13 2 12 14 14 6 6 13 2 7 14 4 3 6 1 14 2 4 11 6 1 12 11 1 1 10 13 14 10 10 9 12 7 3 14 6 1 13 3 3 4 14 13 11 6 2 9 4 13 8 1 1 14 11 11 5 1 12 13 1 11 11 10 8 4 13 10 12 9 12 11 10 4 13 9 3 8 12 14 11 8 12 1 12 10 11 12 7 13 4 5 1 12 5 2 5 11 7 ...

output:

44626038
246582623
236297640
958360466
833114028
375367409
687063105
847269377
672645663
416320060
21693190
246582623
505255896
63928937
790618705
686805881
686805881
554897457
236297640
206832353
357080151
790618705
118505994
558788292
172513752
505255896
41031500
283423855
634047146
44626038
34056...

result:

ok 18534 lines

Test #40:

score: 0
Accepted
time: 1469ms
memory: 62976kb

input:

1912 200000
30 22 11 26 33 65 1 44 36 34 16 38 39 51 5 8 45 14 11 7 64 36 59 27 16 24 42 5 17 47 14 64 62 62 62 1 20 35 23 20 27 24 14 48 29 68 55 2 34 38 16 69 12 38 131676 60 36 43 55 9 9 38 33 57 65 34 17 43 60 31 62 50 6 19 37 48 38 24 64 67 37 51 34 51 20 59 7 19 25 31 66 54 13 12 40 53 16 9 22...

output:

288408153
896509842
160892278
279372722
271810808
954285045
705745024
562164434
958416188
818979499
649197204
158792093
762062893
56532681
533992061
901583568
857833464
790250206
160892278
6012672
840640581
954691184
79158960
509237258
728365570
389960743
459930632
432198630
456051187
238083183
8535...

result:

ok 1912 lines

Test #41:

score: 0
Accepted
time: 1235ms
memory: 62316kb

input:

823 200000
63 39 42 46 19 53 46 61 50 38 59 35 6 6 60 3 36 6 39 35 50 16 55 27 2 43 37 37 40 1 50 20 46 35 25 40 38 55 64 56 26 54 65 3 29 50 6 28 51 19 13 43 5 17 12 32 4 18 55 6 52 33 5 63 56 40 2 48 29 10 23 40 60 56 5 65 49 47 10 47 3 64 24 21 16 37 2 28 51 56 17 47 57 49 39 45 39 36 31 63 65 9 ...

output:

588664450
141612203
115450531
867813980
583734510
335702952
180239059
633121201
707079922
973343841
956044860
744572656
273417979
44303224
54972054
372932742
744534631
69939939
102857995
844493773
367959811
256678908
55613964
789436249
423887444
939582307
298513178
106275120
257782630
211943722
4275...

result:

ok 823 lines

Test #42:

score: 0
Accepted
time: 1098ms
memory: 60116kb

input:

5408 200000
43 26 43 24 36 7 36 33 21 8 34 19 41 26 1 29 49 15 18 28 41 30 31 34 15 1 13 26 31 2 18 17 29 3 1 5 14 44 34 6 38 10 43 19 21 52 16 30 23 8 48 20 3 47 50 50 31 22 31 40 6 38 38 14 23 31 34 2 38 47 4 47 4 6 52 7 42 24 19 8 31 31 40 23 2 6 22 15 37 36 6 33 14 28 13 24 21 22 32 32 39 29 35 ...

output:

629981573
272361276
809033833
647038076
733697009
851628243
664706039
82477980
170663897
945495390
529766460
776237838
603623264
592209346
623153719
320494038
682616371
945397313
97042787
441362771
298079522
396009747
393668207
801566817
370507857
623153719
115043523
437077949
753513400
495130199
96...

result:

ok 5408 lines

Test #43:

score: 0
Accepted
time: 1219ms
memory: 59532kb

input:

8037 200000
8 32 3 40 23 12 1 34 9 26 37 40 32 17 17 31 41 36 16 39 18 25 27 26 17 15 7 9 15 24 37 32 31 37 17 21 43 11 40 36 11 3 27 2 18 24 6 2 37 21 22 22 27 15 38 38 30 21 9 32 36 21 30 19 4 4 19 34 9 18 21 9 14 29 26 5 24 10 16 32 43 8 21 22 26 1 21 37 38 25 23 24 39 25 38 38 41 23 12 38 24 7 1...

output:

204906024
818946855
166818860
391492958
763052
6129377
721102522
329953566
905275329
974374260
880333078
668686315
675965770
699418336
279810638
74270875
376662726
689448565
297165430
554725136
703046515
919464396
112766272
622232713
228221081
330414328
967227220
780401999
155397834
336306527
375443...

result:

ok 8037 lines

Test #44:

score: 0
Accepted
time: 1717ms
memory: 116016kb

input:

200000 200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
...

result:

ok 200000 lines

Test #45:

score: -100
Runtime Error

input:

133404 200000
1 1 2 1 1 2 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 1 2 2 2 1 1 1 1 2 1 2 2 1 1 1 1 2 2 1 2 1 2 2 1 2 1 1 2 2 2 2 1 1 1 1 1 2 1 1 2 2 1 1 2 2 1 1 2 2 1 2 2 1 1 2 1 1 1 1 1 1 1 2 2 1 2 1 2 2 1 2 2 1 1 2 2 2 1 2 1 2 1 2 1 2 2 1 2 1 2 2 1 2 1 2 2 2 1 2 2 1 1 1 1 1 2 2 1 1 2 2 2 1 2 1 1 2 ...

output:


result: