QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#384641#6846. Wiring EngineeringdsostTL 2157ms15176kbC++204.4kb2024-04-10 08:23:092024-04-10 08:23:09

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 9800kb

input:

3 4
1 2 1
2 1 2
1 2 3
4 5 6
3 2 1
1 3 1 3
2 3 1 2
1 1 2 3
1 2 2 3

output:

8
5
1
7

result:

ok 4 lines

Test #2:

score: 0
Accepted
time: 30ms
memory: 11244kb

input:

24 90000
8793 8115 9643 2814 6394 7070 3822 4788 6737 6506 2901 4772 5347 5050 3493 2803 584 2544 3834 678 9891 2958 5475 522
9057 3674 3163 6433 5937 8480 4815 1201 5509 1303 4151 8190 6229 9339 9765 3011 2256 3682 8442 3641 2268 5609 4948 9632
5872 4006 7690 2611 5381 6184 9483 8527 8248 960 8124 ...

output:

0
0
0
0
0
0
734
8060
10799
10799
14772
14772
14772
14772
14772
20708
24243
25895
27159
33403
33403
33403
33469
33469
0
0
0
0
0
734
8060
10799
10799
14772
14772
14772
14772
14772
20708
24243
25895
27159
33403
33403
33403
33469
33469
0
0
0
0
402
7728
10467
10467
14440
14440
14440
14440
14440
20376
239...

result:

ok 90000 lines

Test #3:

score: 0
Accepted
time: 26ms
memory: 12876kb

input:

24 90000
2882 8334 4022 5376 8457 3340 867 899 1508 727 7364 623 6553 7553 7719 6763 7732 3004 5920 4146 6661 4104 6283 8972
4478 5974 4930 4992 3905 9280 5603 2194 7539 6619 5862 151 8423 5365 219 5041 7657 7324 5990 3400 8540 4062 4172 7347
8383 9811 9948 8647 930 20 3735 8411 4325 4279 8849 3616 ...

output:

1023
4860
9878
13533
13533
13533
13533
19750
19750
19750
22737
26202
26202
26202
30484
31526
31526
32471
32471
38273
38273
43569
48112
48112
955
5973
9628
9628
9628
9628
15845
15845
15845
18832
22297
22297
22297
26579
27621
27621
28566
28566
34368
34368
39664
44207
44207
2136
5791
5791
5791
5791
120...

result:

ok 90000 lines

Test #4:

score: 0
Accepted
time: 27ms
memory: 10848kb

input:

24 90000
5827 3068 5413 8083 80 9169 8321 3897 4658 7830 2340 8206 1214 6308 5129 1455 2916 1859 2482 5258 7060 9652 1082 800
8155 1732 6246 3960 245 1183 1414 1277 4968 8201 6267 1932 1361 6774 1087 2440 3409 5345 8071 3990 632 7664 4733 5294
1185 6622 9262 7354 2910 1548 9877 2515 9039 9202 2820 2...

output:

0
0
2079
5473
8138
8503
16966
18204
22275
23276
23276
24228
24464
25082
28124
34856
34856
36225
36225
36225
36225
36225
36225
40176
0
2079
5473
8138
8503
16966
18204
22275
23276
23276
24228
24464
25082
28124
34856
34856
36225
36225
36225
36225
36225
36225
40176
0
583
3248
3613
12076
13314
17385
1838...

result:

ok 90000 lines

Test #5:

score: 0
Accepted
time: 26ms
memory: 12988kb

input:

24 90000
228 448 373 1000 1000 49 571 217 799 531 838 609 889 615 683 578 956 218 842 100 180 312 835 691
803 486 792 277 841 190 476 794 717 234 109 947 795 631 353 1000 708 501 113 708 125 716 452 915
9676 6488 8908 3177 3346 767 6103 2588 9360 3035 1212 564 8822 4147 8260 8212 6538 6006 8716 5567...

output:

8645
14647
22763
25663
28168
28745
34372
36166
44809
47610
48713
48713
56740
60256
68163
75375
81205
86710
95313
100172
107154
115433
124423
126873
5774
13890
16790
19295
19872
25499
27293
35936
38737
39840
39840
47867
51383
59290
66502
72332
77837
86440
91299
98281
106560
115550
118000
7888
10788
1...

result:

ok 90000 lines

Test #6:

score: 0
Accepted
time: 26ms
memory: 11268kb

input:

24 90000
57 21 22 28 66 90 53 16 85 37 59 21 34 17 16 47 21 32 22 27 93 52 63 66
15 7 77 52 38 42 24 38 81 49 57 45 36 63 23 93 75 28 23 34 48 71 78 64
8367 4296 343 546 7650 5845 8498 5888 2483 9099 2698 5872 3982 1036 6415 4326 9263 7076 7818 7907 6825 3203 2048 5487
6642 3448 1683 9585 9322 1651 ...

output:

8295
12584
12850
13344
20956
26759
35233
41083
43485
52535
55176
61003
64949
65922
72314
76547
85735
92783
100578
108451
115228
118360
120330
125753
4232
4498
4992
12604
18407
26881
32731
35133
44183
46824
52651
56597
57570
63962
68195
77383
84431
92226
100099
106876
110008
111978
117401
209
703
831...

result:

ok 90000 lines

Test #7:

score: 0
Accepted
time: 30ms
memory: 11172kb

input:

24 90000
2 2 10 6 7 7 2 9 1 8 1 2 9 6 6 10 7 8 7 6 6 5 4 5
3 9 4 5 2 3 8 2 6 2 6 2 5 1 10 5 4 3 2 6 5 7 1 1
8155 8001 2384 8872 2623 129 2105 9830 6007 6485 9339 7456 6246 1156 2019 1875 8275 6950 7885 4501 114 1456 9206 5279
9157 6539 6206 9430 353 5870 4767 6957 6129 3742 9953 8631 9898 8230 9641 ...

output:

8150
16142
18522
27389
30010
30136
32233
42061
48062
54545
63878
71332
77573
78728
80737
82607
90878
97825
105708
110203
110312
111761
120966
126244
7990
10370
19237
21858
21984
24081
33909
39910
46393
55726
63180
69421
70576
72585
74455
82726
89673
97556
102051
102160
103609
112814
118092
2378
1124...

result:

ok 90000 lines

Test #8:

score: 0
Accepted
time: 27ms
memory: 10904kb

input:

24 90000
1571 8593 7110 9439 5693 6004 2083 6762 6156 1082 3311 4826 2735 1518 4964 1627 8600 5434 1698 2333 1492 1819 9208 2385
6759 1678 1244 3701 7214 7740 7859 2612 1754 3579 702 7842 7407 6886 5612 9788 3791 803 8242 9388 2543 588 2137 3026
14 563 354 730 30 468 695 422 800 230 867 880 753 350 ...

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 90000 lines

Test #9:

score: 0
Accepted
time: 20ms
memory: 8748kb

input:

24 90000
9515 4114 9111 3785 1401 5622 2365 4538 8244 4565 1230 4659 6600 3020 4874 9402 7318 2149 8497 8821 657 3842 5678 9041
9219 834 1567 7528 7313 4701 6148 825 1732 3368 6419 6495 891 3569 9742 3361 5403 8315 5596 1155 6579 3964 772 4468
92 61 97 17 83 25 29 92 14 37 15 32 50 54 9 41 59 14 100...

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 90000 lines

Test #10:

score: 0
Accepted
time: 27ms
memory: 10920kb

input:

24 90000
7875 1831 8812 3686 3105 6713 7181 2621 3079 6665 4084 8202 6751 7113 1494 1987 9855 2854 12 5890 9938 529 9565 9636
5255 6704 8421 6138 595 5015 838 4001 5426 5839 3906 5656 568 6666 1024 8857 8690 237 8891 6247 6726 3097 1844 6980
9 3 8 1 8 9 3 7 4 7 8 7 1 5 6 3 3 5 3 3 4 3 8 3
9 3 10 8 8...

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 90000 lines

Test #11:

score: 0
Accepted
time: 1929ms
memory: 12956kb

input:

300 100000
5892 2941 7796 3824 7699 6234 1720 4553 2224 3340 9567 897 7270 8556 8074 3842 7509 6342 9185 3140 3418 9783 8997 2773 8953 3806 9039 5780 5753 2259 6707 3211 3341 9795 8101 486 449 2952 3278 5997 1371 7167 5793 6654 4562 8639 8974 3875 754 7239 5575 4763 7555 4170 306 613 61 5074 2372 45...

output:

1364797
946433
634894
474007
768328
443123
542090
200215
287951
296984
190606
1146449
709971
919511
543428
787464
863764
980126
145438
413745
583043
1151004
138271
741758
344448
396168
282972
559104
625322
1017928
329022
1020933
441078
554377
886603
651482
791217
538517
181464
562969
662860
311649
4...

result:

ok 100000 lines

Test #12:

score: 0
Accepted
time: 1790ms
memory: 13776kb

input:

300 100000
6268 1156 2360 305 185 7948 884 3679 9996 3778 3727 7152 7329 2502 5778 3837 4353 198 4953 253 656 2762 2736 3861 5243 6592 3070 7190 9210 8017 174 6078 833 5170 5193 1132 7791 1613 8691 5650 2807 7694 7688 6304 7548 3315 2253 4529 5277 9817 1356 6463 2885 6682 3681 1261 6508 63 1024 4707...

output:

594192
664164
709764
911359
830339
1465776
847623
445582
1012558
472484
1023314
733688
370710
457441
682893
746625
1003832
98769
979488
439442
72686
370339
269618
1383271
377547
701678
62656
645637
865577
598519
685255
503807
382531
143509
841485
371148
454701
185208
346999
715422
892361
793054
4645...

result:

ok 100000 lines

Test #13:

score: 0
Accepted
time: 2157ms
memory: 13840kb

input:

300 100000
3427 2804 298 9132 705 7279 4384 6949 3693 7286 8284 9913 7929 7021 9878 2202 2883 2121 7131 8468 6085 722 2490 7970 4702 6264 8136 6544 478 9413 2470 518 190 9524 8652 4940 8764 7252 3326 6090 6874 2387 4206 3324 5978 8513 2849 230 8044 3717 2312 1040 1917 9631 9986 9055 858 4846 9249 40...

output:

459933
876199
349360
728416
377659
1418424
1055339
229755
207568
525787
560076
687940
605657
402795
379959
103061
783783
550977
185993
1378825
715382
442275
609454
784052
694823
209646
927888
495233
682011
159373
221676
235598
586269
781145
701797
280268
503466
476109
326949
160359
244893
841634
101...

result:

ok 100000 lines

Test #14:

score: 0
Accepted
time: 1629ms
memory: 13948kb

input:

300 100000
203 112 810 54 965 763 752 945 162 116 481 596 572 338 771 378 525 758 317 832 167 96 416 324 155 830 940 390 943 604 954 996 112 226 143 583 678 681 254 704 794 405 869 932 968 244 73 78 165 470 795 416 232 111 847 82 919 234 903 370 433 513 740 550 738 249 415 492 283 857 281 770 813 42...

output:

995321
153484
1788754
1072283
1029180
485125
617623
2787299
2406603
1083441
600958
1042863
1017166
711052
1597637
1101400
1480995
1591242
1136224
1770419
1321613
1019176
1907413
737598
2016230
410406
1434243
85954
1406674
762096
604562
448091
585744
1600657
429106
636858
748323
2800424
744925
270864...

result:

ok 100000 lines

Test #15:

score: 0
Accepted
time: 1519ms
memory: 15048kb

input:

300 100000
10 62 93 8 64 37 6 27 25 11 85 81 78 3 24 15 40 40 51 90 50 5 14 27 6 44 60 20 42 85 88 43 97 14 100 19 91 33 32 54 21 18 4 98 3 35 94 98 32 81 30 12 88 87 53 54 85 82 76 67 81 54 21 1 45 28 82 99 16 27 32 5 94 96 63 7 51 80 4 39 38 50 46 95 4 61 99 54 76 99 47 65 28 87 88 7 42 46 72 28 9...

output:

727938
1465680
394429
2087611
3403699
1148390
1252684
684796
1477054
856947
2972151
1478885
449508
1930961
649064
602516
1046342
254644
588557
1383781
261661
237514
1053488
756980
613517
1508726
1165965
185712
2855687
580217
2054256
1211662
938828
1523668
650548
631591
1353228
1360711
928520
944771
...

result:

ok 100000 lines

Test #16:

score: 0
Accepted
time: 1351ms
memory: 14500kb

input:

300 100000
9 3 6 8 2 5 7 9 6 7 9 7 1 9 2 8 8 4 1 1 2 8 5 3 7 3 9 5 10 1 4 8 10 3 8 6 2 9 4 5 7 1 4 7 3 10 1 3 7 8 7 1 4 6 4 6 10 5 7 9 3 7 2 1 1 9 1 5 4 1 7 4 6 7 3 6 1 5 1 8 10 9 3 3 4 7 2 8 4 3 2 10 7 6 7 9 2 8 10 2 10 1 3 10 7 6 2 4 7 2 3 8 4 1 9 10 2 10 5 3 1 1 8 9 4 2 8 2 10 8 4 9 3 8 1 4 5 7 1...

output:

1014930
1346371
1589962
494375
1563207
1218325
804173
735284
1785496
327773
1633611
1281824
1870426
815071
580509
1276090
284276
2255907
598916
2092307
953528
1551905
2277598
848017
1654284
381809
1451204
3101713
113919
354538
2074374
1264404
1167540
760069
1557682
1719804
1318711
549026
1147358
878...

result:

ok 100000 lines

Test #17:

score: 0
Accepted
time: 1316ms
memory: 15176kb

input:

300 100000
3929 9383 3139 5566 8662 3751 7348 2114 5423 5267 4176 8566 5586 3532 4356 9147 6577 2066 9348 8019 6308 1508 4061 1334 627 6320 2446 5418 777 9879 3403 2241 1558 7262 6621 9617 4897 494 8647 5663 1717 9610 7065 9341 9029 4770 7296 374 6674 7419 772 3953 7570 2890 554 312 5379 2623 4243 3...

output:

1600
9470
639
3820
7084
5042
152
6684
3400
4904
438
9676
7983
4077
8412
7076
7725
6622
2291
5490
5979
3898
14341
6513
498
8987
3767
7765
3680
5888
2261
7047
5520
3138
6504
1462
2624
3995
3341
11918
9218
6776
454
0
0
2778
608
7364
778
2138
4412
14518
2219
3182
10627
4023
4781
878
9885
3052
1370
1044
...

result:

ok 100000 lines

Test #18:

score: 0
Accepted
time: 1129ms
memory: 15120kb

input:

300 100000
3112 8934 421 7792 3527 4028 5471 1329 9133 7175 2260 2604 6673 1445 3068 2895 5285 5003 9970 1846 765 8180 1616 1939 2502 6430 2351 3904 5111 6225 228 103 6178 2566 1048 4229 4126 4668 4042 5118 9620 6697 640 4142 2729 1103 9446 4459 4363 6088 2809 8210 119 9613 1950 9540 1348 9516 8003 ...

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

score: 0
Accepted
time: 1133ms
memory: 15132kb

input:

300 100000
5803 7547 6909 4457 8699 6825 8469 885 1728 5483 565 7815 3322 4322 7653 4866 6142 9753 4423 8057 9119 9290 9681 281 3659 6296 9307 8761 9587 5406 9160 6508 2647 4843 3652 2365 1418 3639 4700 187 168 8298 1510 3876 6582 8246 515 7054 9401 9765 5793 4986 3810 9022 9469 7731 955 5392 3658 7...

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

score: -100
Time Limit Exceeded

input:

500 300000
8897 103 1496 3525 3524 2591 3767 3998 1607 4835 7462 8224 4406 1683 5324 2067 4867 3711 9666 7955 9393 4540 6056 4543 6393 6678 9712 4811 248 7112 5169 494 735 7589 8565 1029 2338 5651 6043 9806 1754 8379 8278 9678 5171 7371 6811 4108 9582 7140 6727 8771 2416 2267 1112 5684 1090 76 4479 ...

output:


result: