QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#450526#7401. Ternary String Revolutionucup-team1005#AC ✓461ms16936kbC++203.1kb2024-06-22 15:07:002024-06-22 15:07:01

詳細信息

Test #1:

score: 100
Accepted
time: 112ms
memory: 14200kb

input:

2
11 4
01021001020
0
1
2
012
6 3
012210
0
1
2

output:

6
3
4
0
2
4
4

result:

ok 7 tokens

Test #2:

score: 0
Accepted
time: 461ms
memory: 14732kb

input:

181890
4 2
0121
0
2
1 2
2
2
0
7 3
2102011
122
21
2
9 1
222022212
01
7 2
0122000
0
0
1 2
2
2
212
10 2
1111011000
1210
02
2 3
01
222
22
22
10 3
1121121121
21
2
1
10 4
2201210022
202
122
20
00
7 2
0102010
221222
2
1 3
2
20
212
21
5 5
21112
00101221
202
0
20
0
9 3
022200012
10
2021
0
8 2
12212200
122
1
...

output:

1
2
1
0
4
2
4
9
5
5
1
0
1
2
1
0
0
3
3
7
0
5
1
3
1
3
0
0
0
2
1
1
1
1
0
0
7
6
6
2
2
2
2
2
1
4
4
3
2
0
1
1
0
0
0
2
0
2
1
1
1
1
3
0
0
1
3
0
3
3
7
3
3
0
0
1
1
0
1
3
1
1
5
2
1
2
1
0
7
2
2
5
5
5
5
0
3
3
0
3
3
2
0
2
3
1
0
0
0
2
3
3
3
3
3
6
1
0
0
2
1
0
0
2
1
3
2
1
2
4
4
4
4
3
3
4
4
2
5
5
0
0
1
0
1
0
0
3
3
2
...

result:

ok 403256 tokens

Test #3:

score: 0
Accepted
time: 351ms
memory: 14216kb

input:

100000
10 1
1102212120
10
10 8
2002121021
110
1202011212
0220
220110212
0020110
1
2
2
10 1
1212222011
1100
10 2
0002020102
2
2
10 6
0012122020
2222021120
1111200
220112
2100
11
1
10 1
0111222201
1
10 2
1200020000
22
2
10 1
1012101011
0
10 3
2101122120
11000100
02200
1
10 3
2020011122
002
1
101002
10...

output:

2
1
3
2
1
2
4
4
4
1
5
5
2
1
1
1
2
5
6
6
6
4
6
3
7
4
4
2
4
2
0
10
1
6
5
0
1
6
0
10
5
0
3
6
0
5
5
0
3
3
1
9
6
2
11
11
8
8
8
0
3
6
4
7
2
1
5
4
7
3
5
4
5
5
10
3
3
2
7
7
2
7
5
8
8
3
5
3
5
5
1
9
2
4
7
4
3
3
6
1
3
4
0
8
5
1
5
0
7
5
0
10
0
6
9
6
0
3
2
6
4
2
4
8
4
3
3
3
5
3
1
3
2
3
3
0
0
0
3
1
3
0
4
11
5
3
0...

result:

ok 305998 tokens

Test #4:

score: 0
Accepted
time: 376ms
memory: 15912kb

input:

66689
15 6
102202000022210
1110102010
01100011
121201122
22
1220
12
13 3
2201202110022
00102020
1110
0
20 2
20221102122121222001
110
0
18 4
202112020100121110
011
01
022
1222
14 2
12220211012001
01021
2
20 2
22110122211101210010
20120000020
0
13 3
0200010111220
1121201
20
101
13 6
0222101202112
01
2...

output:

5
12
3
6
7
5
10
2
10
6
11
8
13
13
11
3
10
3
15
0
5
5
9
2
5
5
2
5
11
8
5
6
6
5
0
14
7
5
7
4
7
1
9
7
2
6
8
3
6
4
8
12
2
10
10
7
13
0
3
4
10
15
15
2
3
6
3
8
13
18
6
14
6
14
5
3
13
5
4
5
2
4
12
12
2
17
2
12
22
0
15
20
5
0
7
3
3
7
6
2
8
8
0
11
17
9
7
10
10
8
8
6
14
4
7
11
7
6
9
8
11
11
6
8
8
13
2
6
13
18...

result:

ok 213529 tokens

Test #5:

score: 0
Accepted
time: 285ms
memory: 15984kb

input:

13314
86 3
12121212121222011202221022122100212201100110001112210001122201211021010200022022220122
1111022102211100212110221222100011020012202020002
00112212
22021
76 8
0110010210100011200001021210200222121111000101101211101221022100222020110012
1121110112001110001011
0
010010012220212210000212
02000...

output:

146
160
162
108
159
149
123
126
126
160
160
113
139
141
158
141
112
94
68
81
32
160
62
239
264
106
77
142
161
168
142
127
142
151
184
161
166
142
168
147
126
110
168
162
92
131
130
92
109
122
60
76
67
87
76
83
106
106
110
110
110
68
62
80
68
68
63
162
152
162
175
40
103
139
172
137
138
138
153
180
1...

result:

ok 74354 tokens

Test #6:

score: 0
Accepted
time: 277ms
memory: 13884kb

input:

6644
189 5
221022222202210120010002011102220210220201121201012211221011111201001112012100210121210002212101200011012101010101022200102102120110021110100022202012222202211122011110221000200111010112000
2011212102001
02022120020101102222200022211010122000220122
10101011012
200
1
116 9
2020120200211012...

output:

768
736
760
742
780
260
283
301
314
301
287
260
314
296
373
327
389
422
510
636
600
632
669
297
277
304
289
357
347
297
357
310
356
304
614
699
667
685
594
544
689
671
689
544
405
489
489
489
417
421
409
438
445
417
430
423
410
423
414
409
430
414
430
457
466
245
271
297
284
270
296
272
250
297
255
...

result:

ok 41602 tokens

Test #7:

score: 0
Accepted
time: 282ms
memory: 14180kb

input:

2865
436 4
2101120122110010110212212212000001002122022112002220012100121221102102221111101120111222220111222022201101101000120011221000101012001102121121101020112100212222112002100111022020211020112012210122222111212111210220111012202120202121210012112021122100110221121020110002001001002220110121200...

output:

4058
4091
4058
3684
3476
3052
3154
2568
2603
2592
2620
2522
2530
2530
2509
2646
2546
2576
2546
2543
2768
2789
1564
1564
1374
1495
1550
1475
1448
1550
1458
1550
1384
1543
1465
1550
1435
1417
1502
1406
2943
2815
3214
2871
2884
2700
3147
3951
3862
3961
3671
3827
3862
3951
3927
3828
3537
1807
1902
1912
...

result:

ok 23119 tokens

Test #8:

score: 0
Accepted
time: 278ms
memory: 14972kb

input:

1344
921 8
1221000122102210122111011002201221200001020020022101111001110100120112100100220210210112202202201212012222001221022002120020110122010222100122200012201222202112110002102210211211220011121122102220111000122201102100201000200020121212120111110111012200021201100201020212002201110211122100100...

output:

17973
17810
17401
17649
17682
17401
17401
17992
5082
5237
5808
5585
5186
5952
4641
5808
4712
5005
5237
4641
5776
4712
4726
4973
4984
5005
4668
4641
5872
5186
4984
4712
4992
5237
5186
5872
5237
5542
5532
6259
5669
6299
5788
5532
5309
6250
5669
6259
5641
6259
5404
5542
6376
5304
5404
5729
5729
6226
56...

result:

ok 20585 tokens

Test #9:

score: 0
Accepted
time: 275ms
memory: 14600kb

input:

68
18457 396
10010220202210212110122100222210001012201020012010102002202011011100120100112012021110021002102220200001121122020011011100112222011010111222111001002112111100220020122000220211112022000100012212102102121110112121002221101010120020200200200202202021200110101220110201011011212112002111201...

output:

7090114
7098346
7101400
7090743
7096028
7090743
7092798
7103529
7098474
7098474
7103529
7098474
7098346
7101400
7106486
7098474
7090743
7090743
7095040
7090114
7101400
7101400
7088335
7098346
7102754
7090743
7103520
7090114
7091901
7095040
7092798
7110606
7098474
7110606
7102350
7103520
7098346
7093...

result:

ok 33474 tokens

Test #10:

score: 0
Accepted
time: 268ms
memory: 14396kb

input:

67
12013 40
201212120011021221202102001110010120211000120212120212220220200201121211020210002020002022210022221022200022012201201201211022101011112021022012121001112010002011022100101201020220102201222211202021011010121002111020002220100222220222112010022200201211120012020222121220220102020200022211...

output:

3009017
3007182
3006127
3007182
3009017
3006193
3008818
3006267
3008249
3006285
3005186
3010230
3006792
3006398
3003496
3008249
3006193
3004129
3007864
3009054
3006127
3005186
3009017
3005816
3009054
3006398
3006398
3004129
3009017
3006267
3006127
3006267
3005816
3006193
3008249
3006127
3009054
3008...

result:

ok 3440 tokens

Test #11:

score: 0
Accepted
time: 261ms
memory: 14704kb

input:

68
17096 2
1102222110220122201011021122001102022112022212012111012122011121212201211012112022020200022011022120101110210010001211210200011010201100101002012202021121010021202222112202102112021021201000121120020221012222022011212122101210212100011210112121111211211201201202122100110101221021101020111...

output:

6089552
6091883
6170510
6167792
6171738
6170511
7506399
7515643
7505655
7511785
8158324
8152227
8159460
8153474
8158463
8155387
8151333
8154140
8151333
8153177
8153177
8159460
8153474
8155387
8151770
8154289
8152681
8148191
8153177
8152227
8153697
8155387
8151770
5681228
5690275
5685718
5681934
5679...

result:

ok 722 tokens

Test #12:

score: 0
Accepted
time: 260ms
memory: 16056kb

input:

68
16703 5
0020111022022210221200110200202112200111012210100212020110222021202220100100012120112200002200022000111002011022120211101221102012110112212122002002111122100102101202022012120112022121010210122121201020002221010210021112210210122211112101200122221111021002212012100012201010112001222002120...

output:

5808766
5818899
5815584
5806611
5819835
7381872
7377870
7379135
7558300
7557285
7555834
7554632
7553485
7557285
7554508
7557267
7559063
7822417
3044314
3039271
3047195
6561512
6527454
6535070
6560666
6542088
6527454
6530476
6561512
6561512
6560178
6560666
6548187
6542029
6526397
6558049
4953022
4228...

result:

ok 356 tokens

Test #13:

score: 0
Accepted
time: 269ms
memory: 15940kb

input:

67
16023 2
0100201022101100022111012011211110010202021011101221100121121212221000111202022002202111002100002202120021221120211110200120110220020122100021200210012200201000110012121111001120221100000200022122200012121222001022212112012022002102210112112022000101222110012011011210200220020022120201021...

output:

5349365
5349380
2141117
2146070
2242532
2243421
4324427
6122812
4600411
4599139
4605251
4600009
3888113
3895508
2885010
3314333
5217224
3840797
2908371
2884398
7334623
7318704
5448124
5452585
3616175
3620674
7407958
7400792
7412208
6765560
2516496
6942529
6942263
4238069
4366709
2385162
2377187
7495...

result:

ok 112 tokens

Test #14:

score: 0
Accepted
time: 256ms
memory: 15892kb

input:

7
171317 1749
1201021010012111220002110211021202121101110120122022201001212100002011022010010100100111112211220022201222210111020120111211101000101221020022120020022202122101221202211022002220221110111102100220212220221122000010211002220020101112220001222021202121212222020221102201220010011110201022...

output:

611391378
611563202
611340454
611563202
611461307
611448073
611402565
611563202
611402565
611452011
611399004
611448073
611479646
611356182
611402565
611402565
611372807
611486216
611417027
611465177
611417027
611465177
611448073
611402565
611391378
611372807
611464635
611568464
611372807
611399004
...

result:

ok 33386 tokens

Test #15:

score: 0
Accepted
time: 271ms
memory: 14564kb

input:

9
100669 486
20021002202211111121210100021100010000121121212010200011102121002021112001221020112012011012002211020000021111221022201121110212200100201210220111222011010200100011112120010210112010111022220102022211202212012020200101012210200111021110211001001100020220201001202112120202010122211122010...

output:

211126793
211121850
211126890
211118029
211104824
211113963
211134710
211190099
211126793
211173572
211104429
211126890
211104824
211173572
211102272
211122602
211104429
211192439
211170203
211126890
211106675
211102272
211118029
211118029
211116032
211116032
211116032
211118273
211190099
211113963
...

result:

ok 3383 tokens

Test #16:

score: 0
Accepted
time: 266ms
memory: 15012kb

input:

8
101617 217
00202212112111100110211222122212021010212101111221022221212111021210001110222222021110101201102012220212212100210221120010121101210220022110221221120220212021000112012202212210020200220000010022012011122020101101002002220202102121220010221201012101112122220010001122221001010011112202220...

output:

215149130
215102858
215122328
215112932
215112367
215123339
215135127
215111721
215112367
215111688
215132464
215130608
215130608
215122279
215125756
215133427
215149130
215111721
215116626
215132464
215122328
215122328
215132464
215122279
215139171
215112367
215122867
215125756
215122867
215121865
...

result:

ok 667 tokens

Test #17:

score: 0
Accepted
time: 268ms
memory: 14732kb

input:

8
198271 49
212011211121121000000020112012100111102200102010022001201021021210020002022102111101020012112202012011110122110210020212222021021110022121010010120220121022101011100112012010002022011011012212111220012211002102011012201001001000002110102110010221212020001100210112221202100122212001122020...

output:

818968695
818948145
819033872
818999813
818993273
819064598
819064598
819025716
818993668
818970800
818987259
819010986
818993668
818990076
818973359
819010986
819025716
818985320
818984109
818990076
819025716
819033872
818985320
819027648
819010986
819064598
818999813
818993273
819025716
819033872
...

result:

ok 293 tokens

Test #18:

score: 0
Accepted
time: 269ms
memory: 14424kb

input:

7
154978 10
100102011001002221101012000110120111102212020101012012111220022000101112211222121021100111111121220211012100220201120200112202101222122102022012202001101101022000210020220020100220210002202121120201102112111011102101100201122002110022002210212222000002021001200120011001121010212120211000...

output:

500361520
500345636
500386780
500403115
500338189
500361520
500364904
500405787
500405787
500405787
571559112
571541531
505376333
505434647
505466865
505434663
505365512
505377948
505381030
505359569
505397999
505337080
505374542
698297449
698238582
698238582
698231216
698279874
698283230
698262569
...

result:

ok 47 tokens

Test #19:

score: 0
Accepted
time: 257ms
memory: 16484kb

input:

1
1000000 33227
20010122220211201211001110100112211102022200012020200221202012211021120200200002021000021220121100002100210001022222202122221112121201022002112202020121201100202221121012002221011111002202212202002011122101200011102100000010210221120011201002212120201112200101110112021201000022121202...

output:

20833347896
20833519160
20833142873
20833190054
20833195233
20833366674
20833394934
20833190054
20833222259
20833190054
20833340581
20833634802
20833190054
20833347896
20833092982
20833505683
20833142873
20833222259
20833421793
20833265883
20833392091
20833242944
20833366674
20833634802
20833766433
...

result:

ok 33227 tokens

Test #20:

score: 0
Accepted
time: 264ms
memory: 15816kb

input:

1
1000000 3342
102020010200021121201001121001020002211110212010201111211100202022201212210220112201122101200211202220201001112201020111101102201121221102122100012000210200200202111021021121101200221212000012120121202112010022002102201120000211122001122210021212222212002022202112220210112020121221022...

output:

20833131384
20833492591
20833234376
20833262083
20833301551
20833461935
20833234376
20833362843
20833301551
20833449410
20833301551
20833234376
20833012055
20833122523
20833492591
20833223439
20833952214
20833351042
20833461935
20833314173
20833012055
20833239075
20833234376
20833123873
20833458260
...

result:

ok 3342 tokens

Test #21:

score: 0
Accepted
time: 266ms
memory: 16760kb

input:

1
1000000 330
1112021200002020201102101122001120220222211010022000221120110011200120111011200200222100022022222002221101021211221100122222121222102112202112001202011002020010100022120120211210212020020202122212210111001102201001010201011012011110010000112000221122001121011021100120000120201101020111...

output:

20833534446
20833326841
20833283869
20833235122
20833288001
20833283869
20833326841
20833270707
20833396071
20833298213
20833248101
20833283869
20833216183
20833322140
20833288001
20833310646
20833521688
20833188821
20833534446
20833288001
20833310646
20833248101
20833727996
20833384324
20833326841
...

result:

ok 330 tokens

Test #22:

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

input:

1
1000000 36
11112011221200101212120100021102112002201002122220000021100010220112120211000210010000110100021021110221120211212110220120220122100110022022221020112021110011002001202002021212122202012110212111202020221110201010111210121012220021100212000010021122110112101020121110220112011210201102200...

output:

20833118075
20833207366
20833349897
20833437871
20833263630
20833688786
20833332884
20833443054
20833207366
20833534838
20833316517
20833277299
20833349897
20833349897
20833216442
20833263630
20833263630
20833277299
20833331064
20833349897
20833280455
20833240633
20833367601
20833118075
20833263630
...

result:

ok 36 tokens

Test #23:

score: 0
Accepted
time: 263ms
memory: 16328kb

input:

1
1000000 4
210120110221002002102222020202022020111202021112010121020001110102010020112120022011111002120002201200101022122221200202200222212211122010212011112120201210202210221210010021010100202221122211111010200121122120220010000221210221100101221022101100100100002222000001002202111000212221002201...

output:

20832422227
20833617218
20832860858
20834426996

result:

ok 4 tokens

Test #24:

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

input:

1
1000000 1
202012011000210001211110221112011220001200011201001121010101111100021020100000220021110200210110002221201201200000022212221020200120002101201010211021210021122210121211020112102212021002110222222110112100221111001121122111211110000002000000111200121100212200200100111201220022112202010201...

output:

20833212925

result:

ok "20833212925"

Extra Test:

score: 0
Extra Test Passed