QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#587774#5551. Selling RNA StrandsNova_NightWind0311100 ✓162ms480204kbC++202.9kb2024-09-24 21:34:132024-09-24 21:34:13

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 78ms
memory: 382296kb

input:

100 100
A
G
AGC
AUA
C
CCA
CGGAG
CCGAG
GACA
UCAAC
CUUAU
AC
A
CGUA
UAUG
UGCGA
GCU
GUUAU
UAAU
A
UAA
U
CGCCC
GCG
U
AUUC
GACA
CC
AG
GUCGU
UUCA
AGGC
G
CU
UG
CUUA
CUAU
AA
A
GUUG
GGU
UU
C
GCUG
C
GUGGA
C
UAU
UAG
GC
GUU
GC
UCUCA
U
AA
AG
C
GGU
GC
CCUG
CCUU
GG
CAGCU
UAGGU
GGCUC
CUACG
UGC
UU
UAAUG
UGGCA
CAA
UGAG...

output:

9
1
11
1
1
2
4
3
11
6
1
2
1
1
4
2
1
11
10
1
5
1
1
1
1
11
1
13
1
1
3
1
11
1
11
11
1
2
2
1
1
10
1
1
1
2
4
2
1
13
10
1
1
1
2
1
1
4
1
2
1
1
9
9
13
2
1
2
9
2
1
10
2
2
1
9
1
1
1
1
1
1
1
9
1
1
11
11
1
1
1
1
2
13
1
2
1
13
1
1

result:

ok 100 lines

Test #2:

score: 10
Accepted
time: 63ms
memory: 382824kb

input:

100 100
U
CUAG
AUCA
UAACG
U
GG
CUCCA
G
G
UGCCA
CGA
ACAAU
GUUA
GUAGA
AUCU
C
GC
ACACG
UUG
CCC
U
UUGUC
AUC
GAA
U
CGGA
U
AGA
GCU
AAG
CUA
UCGG
GGG
UCG
GGAU
U
CGA
CCAUG
ACG
G
C
CUU
GUCU
UUAU
UACU
UCC
UGAAG
GCAAU
CUCG
GAG
U
ACC
CUAU
CU
UU
AAGUA
AGGU
CGAA
U
GCU
AA
CAA
G
UAGGG
A
UCU
A
AA
G
UAC
GC
CAC
AGUGA
U...

output:

1
5
1
8
14
1
5
1
12
1
2
2
12
1
1
6
8
1
1
4
5
2
1
1
3
1
1
1
2
2
1
1
2
1
1
14
1
1
1
1
2
1
2
1
1
14
1
1
2
8
1
14
2
12
1
1
1
7
1
2
1
1
12
5
1
1
1
2
12
1
1
14
2
8
1
1
1
6
3
1
2
1
5
12
1
1
1
1
3
1
1
12
14
1
14
1
4
1
2
14

result:

ok 100 lines

Test #3:

score: 10
Accepted
time: 52ms
memory: 382508kb

input:

100 100
GACC
CACCU
GGCC
UGUA
UCAG
UUUGU
GU
AGUAC
ACUG
UAGAG
UCAA
GGCA
G
GGUU
CGA
A
G
UUUGG
CGA
UG
AU
GAC
AA
GGGA
AGA
AC
AGCAG
AGU
A
UUUAA
G
UGC
ACGUC
A
AUAAA
UAAAA
CGU
AUGAC
GAUA
UGUCC
AACU
AAUA
CUAA
C
CG
G
GGC
UGACC
AUGU
U
UA
GAAUA
AG
UA
UGGAC
AAG
CCGC
UA
CGCAA
A
CCG
UAAAA
GAG
CGG
UA
GAUG
GGA
UCAUU...

output:

2
4
9
9
1
3
9
1
6
11
1
1
1
1
1
11
2
1
2
9
4
5
1
2
1
11
3
1
4
2
1
1
9
1
11
1
11
4
11
1
2
9
1
1
1
1
1
1
2
1
4
1
1
4
9
9
3
11
1
1
1
1
3
5
6
1
2
1
4
1
2
2
6
9
1
1
5
1
4
3
2
1
1
4
10
1
2
1
2
2
11
2
1
1
2
3
1
1
1
1

result:

ok 100 lines

Test #4:

score: 10
Accepted
time: 56ms
memory: 382672kb

input:

100 100
CCG
UAAUA
AGUUU
GAG
GUAGC
A
AAUC
UC
ACCC
A
U
UCGG
AG
G
AG
AC
AAGAA
GCGAU
CGUC
G
AG
UUAAU
CGUGU
GUCG
A
UA
AU
GAAAC
AUG
CGUG
ACGG
G
C
AUG
GAUU
ACGG
GGA
CU
UG
U
AAA
C
UAUGU
UAC
CUA
ACC
CGAUG
GCC
UACG
CCA
UAAU
UUAAA
C
UA
GACA
UUGUC
AGCU
UCCA
AAAA
CUUA
GU
UCCGA
C
UUU
AG
UC
UAAU
GGG
CUCCC
C
UUU
UG...

output:

1
1
2
4
9
1
2
2
2
12
1
1
10
2
10
4
12
5
2
1
1
10
8
4
2
5
8
1
1
4
1
3
9
1
1
1
1
2
4
9
2
4
2
2
1
1
1
8
1
1
1
9
1
7
4
1
4
8
1
3
8
10
4
8
8
2
2
4
2
9
2
2
1
1
1
1
1
1
1
2
2
2
1
4
2
9
2
2
8
9
1
2
2
8
6
4
4
12
2
5

result:

ok 100 lines

Test #5:

score: 10
Accepted
time: 52ms
memory: 381844kb

input:

100 100
CAGAA
CU
GAUCU
AAAC
AUGGG
CCUAC
G
C
A
UC
UUCAU
GUCAA
UUA
GG
UG
GCU
GGGCU
UUUA
CAG
G
G
AAUU
ACAU
AUAC
UA
C
UUCC
CA
CUC
A
UA
GGUC
UGG
AGG
GUUCU
AA
ACCC
CAUG
CGCA
A
AU
GAGGU
GG
UCU
AA
AGUC
AGC
AACUA
CUGAC
GGACU
CCGG
AGGA
GAG
UAAG
GA
ACGA
A
UCUGG
CAG
GCAA
GAG
CC
UAAUC
UUGA
AG
U
GGG
AAACG
UA
ACGA...

output:

1
1
13
1
1
1
2
2
1
2
1
1
2
1
8
8
8
1
2
2
4
2
2
2
2
1
3
2
1
2
4
1
1
5
13
4
1
6
13
2
2
10
1
2
2
2
1
5
10
1
1
8
8
8
1
10
1
1
4
3
2
10
3
1
1
5
2
1
5
1
2
3
1
6
1
1
13
1
10
2
2
1
1
1
1
13
3
10
3
2
1
1
2
2
2
5
1
2
10
1

result:

ok 100 lines

Test #6:

score: 10
Accepted
time: 51ms
memory: 382056kb

input:

100 100
UG
G
AA
GA
G
ACAC
GGAAG
GAGU
UG
UUAA
UG
U
AGUUA
CA
C
G
CCCG
U
UAAG
UCUG
CGGU
A
CAC
ACGA
CA
A
UC
GAAUC
A
GAGG
GG
GGG
CCCUC
GACGU
GGUG
GCG
CCAG
C
AUAU
A
AG
UGU
UCGC
UC
AUA
ACGCC
A
GCUA
CCU
G
AGC
GG
GCAUG
GGGUG
C
CCCC
GG
A
AG
AC
UA
CACG
AU
GAG
G
GG
GACC
ACAAC
GCGUG
C
GAA
C
UGCU
GC
ACGGA
AUG
GCA...

output:

14
1
7
5
1
4
7
1
24
4
14
24
1
4
7
1
1
24
1
1
1
4
7
6
3
1
14
4
1
1
1
7
7
6
14
1
24
1
9
1
1
24
7
24
14
9
1
1
1
1
7
9
24
24
7
5
1
3
24
1
1
24
1
3
2
1
9
4
2
2
1
14
7
5
14
14
1
1
2
2
4
24
2
14
1
1
14
3
9
24
7
1
1
4
1
24
9
5
4
14

result:

ok 100 lines

Test #7:

score: 10
Accepted
time: 67ms
memory: 381852kb

input:

100 100
AG
ACACC
GAG
GG
C
AC
AGCA
AAUGU
AGU
UUA
UG
UAC
UU
U
G
G
CUAA
CCG
AAGU
G
CAAU
CCCUA
CCG
G
GACAA
C
CCCAA
UUUCG
UG
C
AAUGC
GCA
A
C
AAUCC
UCGC
UG
GU
GUAUG
CUGG
UUCA
AC
AACU
UA
GAAG
CGGC
ACU
GUAAU
GGGGA
UGAUU
GCA
CUGAG
CUA
UUGGU
GC
CCA
GCAU
AC
U
GG
UGCA
CUACC
GAUAC
UACG
CAUC
GG
GAG
CAU
AUAA
UUA
C...

output:

2
6
1
1
2
13
1
1
4
1
3
2
2
1
1
6
13
1
1
6
2
11
1
4
1
1
8
3
4
1
1
2
2
1
6
1
1
1
3
11
2
2
2
1
1
6
1
6
1
1
8
1
1
1
3
1
2
2
1
1
4
8
1
1
13
1
3
2
1
1
11
3
13
1
1
11
1
4
2
1
13
2
6
11
1
1
6
3
1
1
13
4
3
6
11
6
3
1
1
2

result:

ok 100 lines

Subtask #2:

score: 25
Accepted

Dependency #1:

100%
Accepted

Test #8:

score: 25
Accepted
time: 135ms
memory: 434788kb

input:

2000 2000
ACUGGAACAGAAUCGUUCGAAUCAACAUUUCCCUCGCUUUUGGCUCCCCUCAGUAAUCUUUGUAGUACCGGCCUUCGCGAUCUGCGGCCAUCCCCUCCCAGUUGUUCGAGUUAGGGCAUGCUCUGCAGCGUUGAUUCAGUC
ACUGGAACAGAAUCGUUCGAAUCAACAUUUCCCUCGCUUUUGGCUCCCCUCAGUAAUCUUUGUAGUACCGGCCUUCGCGAUCUGCGGCCAUCCCCUCCCAGUUGUUCGAGUUAGGGCAUGCUCUGCAGCGUUGAUUCAGCAGAUCCUA...

output:

10
54
331
2
46
42
51
21
6
200
111
211
34
70
7
4
1
57
3
9
351
182
3
65
11
3
25
65
101
24
71
310
62
13
294
2
32
139
18
390
14
78
23
299
47
29
1
7
18
95
32
37
39
53
45
18
288
10
76
75
74
3
24
67
31
9
8
3
77
209
20
40
41
34
10
31
12
14
38
199
22
31
164
35
101
11
26
4
4
9
9
25
13
52
12
99
75
214
7
42
53
...

result:

ok 2000 lines

Test #9:

score: 25
Accepted
time: 119ms
memory: 433104kb

input:

5000 5000
AGUGUGCCACUCUAGAAUCCAAGACAGCAUAACUCUGAUCCCGCUAGAUCGUGCAGCCCCGCCGAGAGCAGCGUAGUAGGUCAGUCAUAGGGCUAGACUGAACGGGUACCGCAUACGGUACCAUUGACGGCUGGACCGAUUGCUCCAAGAACGCAAAAGCGUUAGUUGCAUACGGUGAAAGGCCGCCCUGAACGCCACCUUGCAUAAACCGACUACGUCGUAAGAACUGUCCUAGGUAGUGGAACAUCGCAUAUCUAUGCUCGCGUCAGUAUAACUUUGGCUGACUGGUC...

output:

213
82
24
19
271
71
25
167
34
34
17
7
18
14
40
39
33
53
487
126
50
1005
283
30
69
6
327
48
107
103
17
48
15
259
321
41
9
84
34
244
217
41
556
73
42
117
3
122
6
179
261
21
10
61
199
114
265
95
37
30
163
30
113
66
7
152
119
39
3
77
58
458
18
28
12
383
43
224
31
214
11
25
96
127
387
82
253
90
323
6
246...

result:

ok 5000 lines

Test #10:

score: 25
Accepted
time: 103ms
memory: 437576kb

input:

3200 4998
GGCCGAUAGGAACGUCUUCCUUCUAAACCACAGGUCUUUUGACCGCUGCUACCCCAUUCGAUAAAGUAGUCCACGG
AGUAUGUACGGCUCUUACAAUAAAAGGUAUCGGGAUGUGUAUGAACUGACCGCAAGAUCGACAUGUUCGUCUGCACUUCUAUGUUCGUAUCUCUGAGCCACGCGGUUGCCCGGCGUUAGCGCCGGUCACAGUCGAUUUUGACUAUAAUCAUUUUGUCCUGUUGAACAUAAGCACUGCAAUGCACGCGAGAGGGUGGGGCACGCUGUUCGGCAG...

output:

68
21
24
176
183
41
30
360
95
163
136
119
245
23
21
54
11
148
19
43
16
46
572
106
111
8
415
18
66
97
382
401
186
515
188
169
168
13
142
22
19
221
246
19
417
316
232
16
232
314
124
412
735
53
667
239
111
35
148
115
12
545
276
73
551
405
74
7
120
221
25
17
15
239
346
39
185
27
92
549
380
350
425
22
10...

result:

ok 4998 lines

Test #11:

score: 25
Accepted
time: 118ms
memory: 437464kb

input:

5000 5000
UGGACUAGCUAAACUGUGGAACAUUCUCUAGCUUAUAAUGAUUACCAGGCACAUCAUUCCGUGCGGUUGGAGGUUAGGGACCCACAGACCUCCUAGAUCUUUCCGUUGAACAAUGACACUUCCGCAGUGUUUAUCUACGGAGAUCACCACUUAUUGUCACCUACGUUAAUACUAGACCCACAGUGGCUCAUAAACGGUCUAGCUCCGCGCCAUCAUAACAGGCAGUUAGUCGUAGAUCUGAUAAGAGCGUCGUAGAUCGGGGAAGCGAUUCGAGCCAGCCACAUUUAUAC...

output:

18
495
27
467
43
132
61
80
121
60
10
325
235
136
116
939
5
53
72
58
852
151
28
39
26
440
421
84
70
26
186
458
169
8
163
53
720
376
21
40
145
123
18
64
123
64
109
196
18
31
108
166
433
8
102
386
266
5
158
104
160
283
191
798
166
48
19
631
567
8
21
80
5
329
403
5
11
55
8
89
78
14
33
52
1126
46
19
666
...

result:

ok 5000 lines

Test #12:

score: 25
Accepted
time: 162ms
memory: 479168kb

input:

5000 5000
GGUUAAAUAAUGGUAGUUCUCAAUGGUAGGGUUGUUCCUUAGCUUCGGCGUAGGUUGUCUACAGGUGUGGGGCGGCACCAUGCUGGGCCCGUAGAACGGACCGAAUCGUGGGUGUGAUUUGCAGUAACAUCUGCGGCUAACAAGGAUCGCUAACUUUUAAUCUCAGUACGGAUCGAUGUAGCUAGCGGUUGACCAAUUCCUAUAUCUUCAAUACCCACCUUCCUCUGGGAUUAAUUAACUAAGAGGCACAUCUCAGGUGCCAACGACUUGCUACCCAGUUUCGCUAGACG...

output:

1
1
1
1
1
1
1
1
1
348
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
323
1
75
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
308
4
1
1
1
1...

result:

ok 5000 lines

Test #13:

score: 25
Accepted
time: 139ms
memory: 480204kb

input:

5000 5000
GGUCGCACAAAUCUCGGAUAGGAUACUUCUGCACAGCUGGUGGCUAGCUGGGCUAGCCGGCCGCCGAUGGUUCAAGUUCGGCCAGUUCACCCUAACCCAAGACAACCCGCAAUGGAGGGAUACAGGACGGCUGGCCAGGUUCUCGAGCUUAUCU
GUUAUACUUGUUCCUUGGUAGCAUAGUGGCAUUUGUCGUUAUCGGUAAUUCUUAUUAUACUCGCAGGUGUCUCUCCCUUGGACGGGGCGCGGCCAAACGAAGGAUAAGCGA
GGUUUAUAAGAAACCUUCAGCGA...

output:

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
4
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
2
1
1
1
1
6
1
1
1
...

result:

ok 5000 lines

Test #14:

score: 25
Accepted
time: 79ms
memory: 381872kb

input:

1731 5000
A
AA
AAA
AAAA
AAAAA
AAAAAA
AAAAAAA
AAAAAAAA
AAAAAAAAA
AAAAAAAAAA
AAAAAAAAAAA
AAAAAAAAAAAA
AAAAAAAAAAAAA
AAAAAAAAAAAAAA
AAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAA...

output:

1155
635
1170
1270
1379
723
678
999
1248
974
1314
752
1719
1304
1717
1651
1485
640
1528
587
1445
1710
1054
987
1448
544
1508
1006
1114
1213
1490
1034
720
617
1666
959
1695
1580
851
1484
675
1118
1375
844
951
1183
1622
1417
1028
933
749
1008
1475
563
1423
1638
1154
689
1243
990
640
1567
1606
550
1237...

result:

ok 5000 lines

Test #15:

score: 25
Accepted
time: 130ms
memory: 440496kb

input:

5000 5000
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

output:

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
2
1
1
1
1
1
1
1
1
1
1
2
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
2
1
1
1
1
1
1
1
1
1
1
1
1
1
2
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
2
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
...

result:

ok 5000 lines

Test #16:

score: 25
Accepted
time: 111ms
memory: 429876kb

input:

5000 5000
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

output:

1
3
1
1
1
1
1
1
1
96
1
1
1
266
1
266
1
1
1
1
1
1
1
1
3
1
1
1
2
1
1
1
1
2
1
2
1
2
1
1
2
1
1
1
1
2
2
1
1
1
266
1
1
96
1
1
1
1
3
1
1
1
1
1
4
266
1
1
1
1
1
1
1
1
1
2
1
1
1
1
2
2
1
1
1
1
1
1
2
1
1
1
1
2
266
1
1
2
1
1
1
1
2
1
1
1
2
1
1
1
3
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
...

result:

ok 5000 lines

Test #17:

score: 25
Accepted
time: 90ms
memory: 422900kb

input:

5000 5000
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGGCGGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

output:

4998
4998
4998
4998
5000
4998
4998
4998
4998
4998
5000
4998
4998
4998
5000
4998
4998
4998
5000
4998
5000
4999
4998
4998
4998
4998
4998
4998
4998
5000
5000
4998
4999
4998
5000
5000
4998
4998
4998
4998
4998
4998
4998
4998
5000
4998
4998
4998
4998
4998
4998
5000
4998
4998
4998
4999
4998
4998
4998
5000
...

result:

ok 5000 lines

Subtask #3:

score: 25
Accepted

Dependency #1:

100%
Accepted

Test #18:

score: 25
Accepted
time: 74ms
memory: 386004kb

input:

50000 50000
UA
UU
AU
AU
UA
UA
AU
UU
UU
UU
UU
UU
UU
UA
UU
UU
UA
UA
UU
UU
UA
UU
UU
UU
AU
UA
UA
AU
UU
UU
UU
UA
UU
AU
UU
UU
AU
UA
UU
UA
UU
AU
UU
AU
UU
UU
UA
UU
UA
UU
UA
UA
UU
AU
AU
UA
UU
UU
AU
UU
UA
UU
UU
UU
UA
UU
UU
UU
UU
UU
UA
UA
UA
AU
UU
AU
UU
UA
UA
AU
UA
UU
AU
UU
AU
UA
UU
UA
UU
UU
UU
UU
UA
AU
UA
UU
...

output:

12440
12410
12410
12440
25150
25150
25150
12410
25150
25150
25150
25150
12440
12440
12440
12440
25150
12440
12440
12410
12410
12440
25150
12410
25150
25150
25150
12440
25150
25150
25150
12410
12440
12440
12410
12410
25150
12410
12440
25150
25150
12440
25150
12410
12410
25150
25150
25150
12410
25150
...

result:

ok 50000 lines

Test #19:

score: 25
Accepted
time: 92ms
memory: 384524kb

input:

30000 30000
CAUA
CAUUGUCCGGCUAG
CAUUGUAU
CAUUGUCCGUA
CAUUGUCCGGCUCA
CAUUGUCCGGCAC
CAUUGUCCGGCUAUA
CAUUGUCCGGCCU
GC
CAUUGUCC
CAUUGUCCGGCUAAGC
CAUUC
CAUUGGA
CAUUUU
CAUUGUCCGGCUACA
CAUUUC
CAUUGC
CAA
CAUUGUGC
CAU
CACU
UCC
CAUUGUCCGGAGA
CAUUGUCCAC
CAUUGCC
CAUUGUCCGGCUCAA
CAUUGUCCUG
CAUUGUCCC
CAUUGC
CCGC
...

output:

338
549
3133
422
1095
505
91
212
219
3205
364
2347
1001
197
217
173
175
1810
635
231
12
121
893
276
66
24
43
1444
302
25
259
555
329
125
181
121
33
791
231
487
578
16
2251
7317
2242
505
189
30
2596
549
555
541
26
132
1810
958
50
422
32
7317
789
189
102
1824
72
29
268
1059
338
41
386
2347
29
3202
728...

result:

ok 30000 lines

Test #20:

score: 25
Accepted
time: 56ms
memory: 384536kb

input:

40000 40000
U
AGUA
AGUGUC
CUA
AGCGU
AGUGUCUAGAA
AGUGUCUAAAU
AGUGUCUGUG
AGCUA
AGUGUCUAAG
GCG
AGUGUCUACCUG
AGUGUCCGG
AGUGUCUACCAA
A
C
AGUGUCGCU
AGUGUA
AGUGUCUACCG
AGUGUCUU
AGUGUCUACAGC
AUC
AGUGUCUACCAA
AGUGUCUCAU
AGCC
UG
AGUGUCUACCAU
AG
AGUGUCUC
A
AGUAA
AGUGUCUACCAU
AA
AGUGGC
AU
AGUGCC
AGUGUCUAAC
UCU
...

output:

3325
47
15
58
147
123
2658
5
142
190
128
119
682
3284
9626
57
178
36
2638
244
1773
820
2113
241
320
470
1568
905
703
898
360
321
1072
21
1355
514
21
174
3325
345
920
116
119
3002
563
232
870
12
12
107
58
58
319
282
143
29
360
2658
75
230
67
920
360
455
59
330
124
171
2280
771
122
116
18
2088
2088
20...

result:

ok 40000 lines

Test #21:

score: 25
Accepted
time: 59ms
memory: 383736kb

input:

33322 33245
UAA
AUU
UUA
AUA
UAA
AAU
AUA
UUA
UAU
AUU
UAU
AUU
AAU
AUA
AUU
AAU
UAU
AUU
UUA
UUA
UAU
AUU
AUA
AUA
AUU
UAU
AAU
UAA
AUA
UAA
UAU
AUU
AAU
UAU
AAU
AUA
AAU
AAU
AAU
AUU
AUA
UUA
AAU
UAA
UUA
UAU
AUU
UAA
AUU
AUU
UAU
UUA
UUA
UAA
UAA
UAA
AUA
AUU
UAA
UAU
UAA
UUA
AUU
UUA
AUA
UAU
AAU
UAA
AUU
AUU
AAU
UAU
...

output:

3685
7413
7492
7360
7492
3640
3732
3685
7360
7360
7413
3685
3640
7492
7360
3685
7413
3640
7492
3732
7492
7492
7413
7492
7413
7413
7492
7413
3732
7492
7360
7492
3640
7492
3732
7492
7492
7492
7360
7492
7360
7492
3685
7492
7360
7413
7360
7360
7492
7360
7492
7492
7413
3640
3640
7413
7413
3732
3640
7413
...

result:

ok 33245 lines

Test #22:

score: 25
Accepted
time: 56ms
memory: 383896kb

input:

30000 30000
CCUAAGUUU
GU
AU
GCUGGAGCAUAAGUUU
AUU
GGGU
GUAAGUUU
AAU
GGGCAUAAGUUU
AUAAGUUU
AUUAGCAUAAGUUU
UGUAAGUUU
AAA
U
UGCAUAAGUUU
UGAGAGCAUAAGUUU
CCUGGAGCAUAAGUUU
CCAGCAUAAGUUU
AAUGUUU
UAAGAGCAUAAGUUU
GAGCAUAAGUUU
GGUUU
CUU
GGGUUU
AAGUUU
GC
UGUAGCAUAAGUUU
CGGGAGCAUAAGUUU
CGGUUU
ACCCAUAAGUUU
ACGAGC...

output:

160
96
78
1268
261
3199
379
19
834
1822
1039
414
267
1380
11
685
7328
183
827
56
173
462
115
96
319
2236
235
2166
99
1422
56
1039
151
196
2236
42
544
9
41
185
606
190
1039
3199
290
615
79
170
3153
204
264
624
35
183
573
11
203
3153
211
649
1268
199
591
924
67
205
11
597
2404
92
749
54
409
924
597
31...

result:

ok 30000 lines

Test #23:

score: 25
Accepted
time: 59ms
memory: 385892kb

input:

40000 40000
GAGCGGAG
GUGGAG
UGCCACCGGAG
CCGGAG
CAACCGGAG
GAGACCGGAG
GCUACCGGAG
UG
CGUACCGGAG
UCGAG
GACCACCGGAG
CAG
UCGGAG
ACAG
UUACCACCGGAG
AGAACCGGAG
GUACACCGGAG
CG
UCGGAG
GAGCGGAG
CUACCACCGGAG
UGCCACCGGAG
GCCCGGAG
AGCG
GCCCACCGGAG
CA
GACCACCGGAG
AACCGGAG
GGCCGGAG
U
AGGAG
UGACCACCGGAG
AGUAG
UACCGGA...

output:

51
9588
767
267
270
127
444
2092
313
1552
20
300
186
418
1763
99
771
928
62
65
94
1552
290
444
733
254
466
43
444
56
254
29
91
25
864
341
2100
1108
51
567
1094
541
1549
1549
193
658
29
7
744
1094
3
137
1549
221
322
1243
541
1342
466
100
5
48
254
10
54
360
381
1185
44
1342
1763
11
221
439
5
207
251
3...

result:

ok 40000 lines

Subtask #4:

score: 40
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #24:

score: 40
Accepted
time: 103ms
memory: 428432kb

input:

10000 20000
UGAUGAAGACGCACGGCCUCUAUUAGUCUGAAGAUAGUUGGGGGUGUUAAUGUAGGACGGAUAAUGGUCCUAGUCCCGACUCGCUAUGAGUUCACCAAUUGGCAGUGCUAUGAUGACGGCCUCGCACAAUAUUUUGUCUCUAGAUGGGUCAGUCGGGCGAAUACGCCCAUACCGCAGUCUUAUGUAAAGUGUCUAAAUUGGUUAUUUAAGUUGUGACAUCCAUCAGGUUUAUGUUUACAACCAGUAACAAGCCUCACUGGACGCCCAGAUGCAGGUAUUGUCAGUCUA...

output:

83
42
568
635
244
1500
154
41
1344
1442
668
90
1059
758
185
29
662
99
285
68
123
1134
195
204
1142
81
35
133
821
1265
1766
1305
1299
171
222
402
908
39
195
721
117
1164
1500
919
40
174
104
91
65
422
283
475
90
80
144
300
186
50
78
412
1031
199
414
91
237
51
73
49
56
51
411
372
217
883
284
475
55
779...

result:

ok 20000 lines

Test #25:

score: 40
Accepted
time: 91ms
memory: 430228kb

input:

10000 50000
UCCAGCGGAUAAAUCUGAGGAACGCCAAACAGUGGAUAUGGUAAUCUAUACGAUGCGUACGGAUAACCCGCUUAAAGAUGAGUCAACUUAGCUUGAGGAACCCUCUCCGGCUAGAGACUCUGUGCGUCUGGUAUCAAACUCUAUAACAGGGCCGACUGACCCGUUAAUUGUGGGGUCGUUACGCCGGACUUAGGUAAUAAACGUUGGGCAAGUGCAACAGUGACCGCUGACUCAAUCCGUCACUUCAUAGUACUCUAAGGUUAGAUUACAUAGGGUUACUCAUGUGUA...

output:

471
1417
334
151
1532
1352
1364
2036
122
2001
92
99
1434
89
415
159
100
73
97
84
85
114
352
80
98
111
97
1371
1299
94
447
1719
423
1405
372
159
1282
88
73
1622
102
360
502
1639
123
102
98
554
564
1807
1515
1928
98
390
130
1528
1989
106
1693
456
367
305
552
113
348
1600
102
416
1435
1397
76
496
368
4...

result:

ok 50000 lines

Test #26:

score: 40
Accepted
time: 108ms
memory: 427488kb

input:

10000 10000
AUGAAAAAUCCAGAGGAGGUUACAUUACCGAGUGUAAUCGCGCUUCCGUUGAAACAUCUUAUGUUCGACUCCCCGCAAACCAUUCGGUGCUCCAACUCCGGUUGGCUUGGUAGUGCGAGCACACCGUCGUUCAGUAUCAGGUACGGGCGCAUCCGCCAACGUCUCGACUCUUACGGACGUCCCACCGCAUUGCGUUUGGAAAUAAUUCCAGCCUCAAUCCGACCCGCUUGGGUAGUUUAGGAAAGCAUAGUUCGGUUGACACGCCCAUGAGAUGGUCCGUUGAUUGUU...

output:

876
16
147
27
15
17
345
399
72
104
48
126
86
48
25
40
1856
116
194
58
125
528
138
21
225
79
674
560
348
904
330
429
310
322
226
70
907
226
984
389
96
9
100
348
215
28
239
47
35
111
1541
379
259
7
48
26
296
117
10
1597
315
26
19
997
428
259
245
1039
68
162
1533
161
49
318
167
127
57
1316
95
13
41
33
...

result:

ok 10000 lines

Test #27:

score: 40
Accepted
time: 108ms
memory: 437656kb

input:

10000 20000
AAGAGGCGGUGCCGGGCGGAUUGGGCUCAUCCUCUGACCAUAGUCUACAUUCAACGGAUUACGCACCUACCAACGUCUAUAUCCCAUCAGGAUUGAGAGCGAGUGCUUCCUAGCAGGUGCGAACUGUACCAAGAUCCACCUUCUAACGCACCUUUGGAGCACUACAUUGUGGCCCGACUCAGGUUGUAUGUAUUCUACCGAAUCAAUGGACUAAUUACCGCUGCUAAUGCGAACAGUGUCUUGUCGACAUCACGCACUCGCCCUUAACAUGAAACUCCCGGUAAUUUU...

output:

382
332
74
84
362
1175
245
157
241
38
84
786
1339
1709
119
238
455
82
42
2020
928
69
725
87
62
219
86
211
122
302
865
484
203
72
1528
44
335
281
87
202
825
1884
645
1447
361
184
214
325
233
51
155
284
77
904
226
1077
447
203
86
1000
171
267
243
86
67
561
85
223
41
249
62
56
228
1233
179
189
517
196
...

result:

ok 20000 lines

Test #28:

score: 40
Accepted
time: 131ms
memory: 396880kb

input:

100000 100000
CUGGUUACUCUUACA
CUGGUUACUCUUAGAUAAGACUGCCGUCGCUACGGGUAUGGGACAAUAAUUACCACCGAAGCAUGCUACGUCUAGCUUACGGUUCAUAAACCU
CUGGUUACUCUUAGAUAAGACUGCCGUCGCUACGGGUAUGGGACAAUAAUUACCACCGACGC
CUGGUUACUCUUAGAUAAGACUGCCGUCGCUACGGGUAUGCG
CUGGUUACUCUUAGAUAAGACUGCCGUCGCUACGGGUAUGGGACAAUAAUUACCACCGAAGCAUGCUACG...

output:

582
2179
706
301
1680
753
1449
373
2845
8803
234
2869
885
1586
4275
841
5037
19904
190
504
17964
3724
1660
214
2792
2094
2344
4272
18358
440
15044
93
764
520
2624
1937
979
15044
14172
629
11636
540
562
12544
2724
11075
367
1327
1387
102
3913
8437
12301
166
3155
924
6302
875
14682
182
17516
3679
3442...

result:

ok 100000 lines

Test #29:

score: 40
Accepted
time: 84ms
memory: 390728kb

input:

100000 100000
AAUAAAAUAA
AAAAAAUAAA
AAUAAAAAAU
AAUAAAAUAA
AAAUAAAAAU
AAAAAAAUAU
UAAAAAAAAA
AAAUUAAAAA
UAAAAAAAAU
AAUAUAAAAA
AUAAAUAAAA
UAAAAAAUAA
AAUAUAAAAA
UAAAAAAUAA
AAAAAAAAUU
AAAUAAAAAU
AUAAAAAAAA
AAAAAAUAUA
AUAUAAAAAA
AAAAAUUAAA
UAAAAUAAAA
AAUAAAAAAA
UAAAAAAAUA
AUAUAAAAAA
AAUAUAAAAA
AAAAAAAAAU
...

output:

2016
2069
2016
2058
1960
1988
1020
1941
2001
1020
1988
1968
1020
2003
1952
2005
1988
1933
991
1991
2133
2069
2041
1991
1943
2004
2004
1943
1991
2072
1972
2031
991
2020
1933
2016
1990
2014
1968
1968
1960
984
2031
2133
2058
2058
1988
2001
2058
2031
2014
2000
2009
1972
1952
1020
2005
2014
2003
998
2031...

result:

ok 100000 lines

Extra Test:

score: 0
Extra Test Passed