QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#873042#9735. Japanese BandscarrotqqAC ✓880ms20304kbC++141.6kb2025-01-26 08:06:382025-01-26 08:06:39

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 5960kb

input:

3
2 3 3 3
2 3
1 1
2 3
2 2 2 1
1 1
1 1 10 2
1 2
1 3

output:

6
4
0

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 784ms
memory: 20304kb

input:

500
481199252 336470888 8 58
4 7
7 6
4 7
2 6
2 6
2 7
8 3
8 7
8 1
2 6
2 6
1 2
1 5
3 1
6 4
2 4
4 7
2 6
2 3
7 1
4 4
5 1
2 7
6 7
8 1
8 7
5 6
4 2
4 2
8 5
5 4
6 8
5 6
3 8
1 7
1 6
7 1
5 6
6 3
1 1
2 7
3 3
1 5
5 5
8 7
3 4
6 3
8 8
7 4
1 6
2 1
8 7
4 5
2 7
3 5
2 6
4 5
4 3
2 6 2 2
2 1
1 1
500330171 987581927 10 ...

output:

724920553
11
966099120
846759476
528107862
1
245313614
144990327
1
269113412
946380890
1
0
996348464
376698469
453289929
53346774
238565800
260837053
956196844
0
487514263
842710229
8376584
16
300260118
933415828
808801372
1
612901047
137099259
14974173
0
531418108
1
522718622
264859767
1
1
59318545...

result:

ok 500 lines

Test #3:

score: 0
Accepted
time: 774ms
memory: 20128kb

input:

500
54748096 75475634 8 64
3 8
3 2
3 5
5 6
5 7
5 4
2 2
5 8
5 3
3 5
7 6
1 7
3 3
6 8
3 5
3 4
1 2
7 5
7 6
4 7
8 7
7 5
4 2
3 2
8 5
7 1
4 3
4 6
3 3
8 3
6 1
5 4
1 4
2 3
5 6
1 4
5 8
8 2
1 3
8 1
5 7
1 2
3 8
4 2
5 4
7 2
4 6
5 8
4 6
3 5
5 7
4 6
4 8
6 4
7 4
3 3
5 2
1 6
4 5
3 1
1 4
5 6
4 3
3 1
44007561 94403501...

output:

48662676
1
138912221
349671067
150052712
86775188
956490545
756234965
1
567881550
726030753
1
914856825
867349578
0
784807018
388018114
433007753
524010032
507842496
282218203
442034917
668340856
1
1
1
489645337
153477090
564466420
1673
0
390234222
604892803
264163973
601602052
135055881
27720
15744...

result:

ok 500 lines

Test #4:

score: 0
Accepted
time: 779ms
memory: 20164kb

input:

500
923264237 374288891 9 36
8 8
5 8
3 6
2 4
2 6
4 7
3 8
3 4
5 5
5 1
9 3
1 9
5 4
5 8
4 3
2 8
7 6
7 3
8 9
3 4
4 1
8 1
7 3
6 3
6 2
9 6
2 3
2 5
6 1
8 5
4 5
3 1
8 7
6 5
3 2
1 1
885955146 964950238 8 59
1 3
7 7
8 1
2 7
6 5
1 3
1 2
2 3
1 2
8 2
4 1
5 6
5 8
3 1
8 3
2 3
8 3
6 5
2 5
6 7
7 2
6 3
6 5
6 7
7 8
8 ...

output:

975815187
715739872
849684680
940532257
1
181582862
672614348
487379998
1
872849956
969457677
827780523
98088
1
496360790
568133531
231661973
1
981238143
13510
8
663802864
252
107191472
18522
415132978
697199493
116414735
1
10
912343690
81
583097677
223080594
33251656
117275734
1
419400938
630591794...

result:

ok 500 lines

Test #5:

score: 0
Accepted
time: 835ms
memory: 20172kb

input:

500
1 9 7 21
4 3
4 5
4 3
4 5
4 5
4 7
4 7
4 2
4 3
4 6
4 1
4 7
4 5
4 1
4 2
4 2
4 2
4 1
4 2
4 6
4 6
192019400 315755530 10 56
8 10
9 7
9 6
8 4
3 4
1 6
8 7
9 10
8 7
5 7
2 4
5 7
1 6
9 7
2 4
1 4
2 7
5 7
5 7
2 10
3 7
8 4
8 4
3 4
5 7
9 6
2 10
3 4
8 10
9 4
5 10
2 4
8 7
5 4
5 7
9 4
8 6
1 7
5 4
8 10
3 4
9 7
8 ...

output:

84
668356110
663215632
0
0
578736401
597267922
0
33363799
1161
80106560
13486
379410136
346687579
215079152
954964869
0
749122504
842423167
0
739926379
822901144
642136628
770357778
886
370384128
817027991
684214806
463554366
759552089
16
384293072
744192004
475
443091214
298039661
815658191
7064088...

result:

ok 500 lines

Test #6:

score: 0
Accepted
time: 880ms
memory: 20288kb

input:

500
365329221 412106895 9 25
3 8
3 9
3 6
3 4
3 4
3 5
3 2
3 9
3 4
3 8
3 7
3 7
3 4
3 7
3 5
3 4
3 1
3 6
3 2
3 2
3 1
3 2
3 7
3 2
3 9
777109873 324284579 2 4
2 1
2 1
2 1
2 1
203265013 578140767 9 46
4 7
4 3
4 9
4 8
4 6
4 9
4 8
4 3
4 6
4 9
4 1
4 6
4 2
4 1
4 3
4 2
4 2
4 9
4 2
4 8
4 1
4 1
4 3
4 2
4 6
4 2
4 ...

output:

437314267
339909689
523663972
939772260
15
294996
873351127
420170527
361605716
10
6317
1015
698532307
716316221
827134829
526287544
433650509
256800385
596882660
574424501
589351733
505841163
517919676
378556809
150786280
1
4103867
986751324
345294966
926479261
557962762
987
133774068
568046845
778...

result:

ok 500 lines

Test #7:

score: 0
Accepted
time: 798ms
memory: 20176kb

input:

500
643910770 5887448 4 3
2 3
4 3
2 3
483024012 714786389 2 1
2 1
735205996 288464482 7 46
4 2
3 7
5 7
4 2
3 1
5 2
4 2
5 2
3 6
3 6
3 2
3 2
3 2
5 7
5 7
4 7
5 2
5 1
4 6
4 1
5 7
5 6
3 2
4 2
3 1
5 7
3 2
4 7
4 2
3 7
3 2
5 7
4 1
3 1
3 1
5 2
5 2
5 6
4 1
4 1
4 2
4 7
4 2
5 1
3 2
4 7
143954125 56574503 3 2
1 ...

output:

772480244
118770152
108641022
615067819
872673860
900276958
951405638
705098808
308078046
912436115
266068466
270465299
858128867
591071828
345756242
253238303
226837537
15366
16188333
896137863
637986485
386483060
601850323
980044594
35
951860846
97816824
379760475
813023811
973778941
948954783
749...

result:

ok 500 lines

Test #8:

score: 0
Accepted
time: 786ms
memory: 20288kb

input:

500
72235422 449924898 2 4
2 1
2 1
2 1
2 1
826908873 897131377 8 44
7 6
7 5
4 2
7 1
7 2
4 5
7 6
4 2
4 8
7 2
4 3
4 3
4 1
4 5
7 1
7 1
4 3
4 2
7 1
4 3
4 2
4 8
7 8
4 8
7 8
7 1
7 5
7 2
4 2
7 2
4 5
7 6
4 5
7 6
7 8
4 3
7 3
7 3
4 2
4 6
4 8
4 1
4 3
4 5
398346835 179283845 3 4
2 1
2 1
2 1
3 1
146844881 503366...

output:

169993670
63971922
447978336
415747130
17523830
520716693
376879328
858277870
165
142685959
3399
88
339812162
591663632
856960754
861425853
527624471
210
960737551
318751600
197044810
0
0
578594559
980927816
1765
215406311
230128376
3178
155563197
347921715
794781090
928438409
129
890907226
21574705...

result:

ok 500 lines

Test #9:

score: 0
Accepted
time: 856ms
memory: 20300kb

input:

500
940751563 43705451 3 2
2 1
1 3
4 2 2 1
2 1
756411639 690869710 9 8
3 5
3 6
3 4
5 1
1 7
2 8
3 8
7 9
892465776 834697020 7 6
6 2
4 7
2 3
1 4
5 7
4 3
3649468 246352594 5 4
5 1
5 2
3 2
2 4
927157783 349300522 2 1
2 1
283790347 262369656 8 7
8 6
2 1
7 4
4 3
4 5
2 4
2 6
290590966 415217454 6 5
6 3
4 3...

output:

366369420
13
764641683
869116386
335233317
587724158
945604675
811601159
131513017
113193821
577434289
177358129
220715079
411623223
706865979
34307455
0
1500
273659818
320221078
332322756
811169602
833121521
0
197721600
910924732
638897790
9520
784101624
445798182
313260639
877480788
935885491
9882...

result:

ok 500 lines

Test #10:

score: 0
Accepted
time: 849ms
memory: 20296kb

input:

500
514300407 782710197 2 1
1 2
872253689 313581735 6 5
3 6
4 5
6 5
3 1
2 4
514655989 526180911 2 1
2 1
813786700 191752057 6 5
3 4
1 2
6 2
3 1
5 4
527846851 580675905 3 2
1 3
1 2
920947549 483871154 4 3
3 4
1 2
4 2
898725255 664985342 7 6
1 5
5 3
3 2
7 6
4 7
4 2
338443592 379946844 6 5
1 6
3 6
4 5
...

output:

359323585
898814710
288847786
98468591
916368235
862413785
267687392
148010090
129433028
849953781
724536941
158837519
498000887
461165396
805773635
983607132
696383636
545900581
14646737
733782
984936679
811469990
529263084
369
536478886
811702967
3930
0
911247824
863805585
857211224
541308891
9855...

result:

ok 500 lines

Test #11:

score: 0
Accepted
time: 780ms
memory: 20288kb

input:

500
799843967 96204862 10 45
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
2 3
2 4
2 5
2 6
2 7
2 8
2 9
2 10
3 4
3 5
3 6
3 7
3 8
3 9
3 10
4 5
4 6
4 7
4 8
4 9
4 10
5 6
5 7
5 8
5 9
5 10
6 7
6 8
6 9
6 10
7 8
7 9
7 10
8 9
8 10
9 10
905549873 312183499 10 45
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
2 3
2 4
2 5
2 6
2 7...

output:

382331873
345030334
53935074
755997739
499731364
338345488
480216832
628179739
857522469
429152121
113184899
431569536
134228466
672765734
335004171
396192449
52161483
51272947
32207679
919199433
449754475
538308198
676557543
394805368
445308710
816052330
946396940
497785742
180220951
694839883
6260...

result:

ok 500 lines

Test #12:

score: 0
Accepted
time: 855ms
memory: 20300kb

input:

500
1 6 9 6
5 1
5 3
6 3
6 1
6 1
6 7
129420744 661597501 8 62
3 1
3 8
2 8
6 4
3 1
3 4
6 1
2 1
5 7
2 7
5 8
6 4
5 4
6 4
6 8
3 7
5 8
5 4
3 1
5 8
6 1
2 1
6 8
2 7
3 7
5 8
5 7
2 8
6 7
6 8
3 1
5 8
2 4
3 4
2 1
6 1
5 8
3 7
3 7
5 8
5 7
3 8
6 8
5 8
3 8
2 4
5 4
2 1
6 7
3 4
6 1
5 1
5 4
6 1
2 1
2 8
2 4
3 8
3 1
2 8...

output:

0
930302674
918021922
2688
555723867
308858890
178115941
626901301
882938426
64529920
436712258
471977032
1629
519031750
917271881
361955135
292918582
311565484
405
139544991
21
699464930
38420897
33144411
581839840
505691688
148834286
802365483
7110
189465901
592848372
318681400
240
221640557
34180...

result:

ok 500 lines

Test #13:

score: 0
Accepted
time: 790ms
memory: 20080kb

input:

500
895037311 678092074 7 36
6 7
3 7
2 7
3 7
5 7
3 7
6 7
2 7
3 7
1 7
6 7
5 7
3 7
4 7
2 7
3 7
5 7
3 7
2 7
6 7
6 7
5 7
4 7
3 7
6 7
3 7
1 7
1 7
3 7
5 7
4 7
5 7
4 7
5 7
6 7
7 7
52057757 883729976 10 28
3 10
5 9
5 4
3 6
2 6
5 4
3 6
7 6
1 4
2 8
3 4
3 6
3 6
5 6
2 8
2 8
7 9
7 4
1 8
5 9
5 8
3 9
3 6
1 8
5 9
5...

output:

233161151
894022147
829968933
145964935
114640012
230469791
0
288215752
11174864
549602378
80509321
19017
420581856
605500953
0
2
295236717
924622203
642457490
854013134
236651816
486381351
833520782
404491379
44
605406498
43
871667863
31975295
35649002
672421739
639452328
705236826
630673111
953965...

result:

ok 500 lines

Test #14:

score: 0
Accepted
time: 789ms
memory: 20172kb

input:

500
468586155 417096820 6 28
5 3
5 2
5 4
5 3
5 4
5 4
5 2
5 4
5 2
5 3
5 4
5 2
5 3
5 6
5 2
5 2
5 6
5 6
5 3
5 3
5 2
5 6
5 3
5 2
5 4
5 6
5 1
5 2
4 2 2 2
2 1
2 2
836098060 22499636 10 34
2 10
4 6
4 9
8 6
2 1
4 5
4 3
8 5
2 7
4 6
2 9
2 7
4 9
2 10
2 9
8 6
2 3
4 7
8 5
4 1
8 3
4 9
2 9
4 7
8 5
8 6
2 10
4 10
8 ...

output:

408372475
7
171802524
325794321
995186738
0
810749469
809308140
503592993
458927433
237386947
0
308217139
56362940
494448309
37021983
704247757
416283140
482723782
732406481
541611906
813899847
24490508
60649103
0
113783786
382459954
410564693
529205101
0
70
845655747
673453250
739070433
718965537
6...

result:

ok 500 lines

Test #15:

score: 0
Accepted
time: 781ms
memory: 20164kb

input:

500
747167704 715910077 8 33
8 3
8 2
7 4
7 3
7 2
8 2
8 5
8 1
7 3
7 6
7 5
7 5
7 4
7 3
7 5
8 2
8 2
8 3
7 1
8 5
8 3
7 4
7 4
8 5
7 3
7 2
7 3
7 6
7 3
8 1
8 8
7 7
8 8
8 6 7 45
6 3
7 3
1 3
2 3
2 3
6 3
4 3
2 3
4 3
4 3
7 3
6 3
1 3
6 3
5 3
2 3
1 3
7 3
2 3
7 3
7 3
7 3
2 3
7 3
1 3
4 3
1 3
2 3
6 3
4 3
6 3
7 3
2 ...

output:

139000868
71554
4437
5862899
868251513
260
748426030
30865
68605040
761772351
0
473513094
546144530
55875522
566399398
366338948
733745709
42
217357908
943153451
3905154
599124546
214536
963664899
856126292
470011885
961166494
940987796
278320
62817794
127124796
695349606
453191086
721167317
3099025...

result:

ok 500 lines

Test #16:

score: 0
Accepted
time: 772ms
memory: 20164kb

input:

500
4 3 5 1
4 1
162093547 16388028 5 1
4 5
34200951 73842336 10 1
10 1
612080836 165443639 8 1
6 1
875502793 513974386 5 1
5 2
4 5 1 1
1 1
970988548 370603489 7 1
2 2
649913003 478356148 6 1
1 2
857048420 32835236 8 1
1 8
568473106 750242567 6 1
3 2
99349978 107435592 9 1
9 4
640639938 785592295 2 1...

output:

975
941126669
905787633
588646519
630682622
1
34217585
478055649
598986924
337100781
788706014
65337363
480574552
761393902
1
5262048
1
665
155121072
548027775
1
869369956
250074205
16315293
450144864
1
20
384927068
83991105
110
60355052
37894993
1
991715366
125962320
422610405
54727539
580452366
1
...

result:

ok 500 lines

Extra Test:

score: 0
Extra Test Passed