QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#673015#9514. 研心yellowbird100 ✓3700ms1429812kbC++2023.7kb2024-10-24 20:18:252024-10-24 20:18:26

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 43ms
memory: 331136kb

input:

10 100
aabaababaaaababbabaaaababaababbbaabbbaabaabaabbbaababaaababbaababababbbaababbbbbbbbaabbbbaabbbbbbbbaabaabbbaabbbbbabbbbbaabbbaabaa
bbaaabaabbbbaaabaaaaabbbbbabaabbabbaabbaabbaabbabbababaabaabbaabbbbbbaaaabbbbabaaaabaaabbbabaaaaaabbaaaabbbabbbbbaaaabbabaababbaabbaaabbbbbbaaaabbbababaabbaaaba
b...

output:

10468

result:

ok single line: '10468'

Test #2:

score: 20
Accepted
time: 64ms
memory: 336860kb

input:

10 100
abbacbbaabababcaabbaabbbabcaccabcabbabbbccaacabaabacccbacaaabbaaabbbaacaabbabcabbbcbacaaaaabaaaabaaacbbccbacacbbaaccacbabcbccacbaaacaaacccbabbaccacaaacaabbbccaaccbbabaabcbbcbcbb
bccabcacbacccbcababaccccaaabbccacaccccabbaabbcacabaccabacbbbaaaabaabccbcaacaaccbcacabcbbbcccccabccbaababccccabcabab...

output:

6384

result:

ok single line: '6384'

Test #3:

score: 20
Accepted
time: 55ms
memory: 331104kb

input:

50 50
aaaaabbabbbbbaababbaaaababaababababbbbaabaaaaaaaabaabbaaabaaaabaaabaabbbabbbababbbbabbbabbaaababbabaabbabbabbabbaaababaaaaabbbbbbaabaabaabbbbbabaaababb
abbabbbaabaaaaabababaabbabaabbbbab
bababbbbaabaabbaabbbbaabaabbbaabbbbaaabbabbbaaabbbbaaabaabbaaaaaabbbabaaaaabbaabaabaaabaaababbbbbaaabbbbbba...

output:

21362

result:

ok single line: '21362'

Test #4:

score: 20
Accepted
time: 47ms
memory: 331128kb

input:

50 50
aababcabbbcbaacaaaaccababbacbbaaabcbaaccabbababbcccaacaaaacacbcbaaabaacabbbbbbaccaaacbbacaacacbcccbbacabbcbcbacababcbbacaccaacacbcccbababaccabccccbabaccababccccbcbabcabcabccaaccababcbccacbbaaaacc
cbaccababccbaaacbccabbcccacacacaaaabaaababcacabaccbccacbcbaaaaabbacbbaccabba
ccbcbcacbcaccabbbccaa...

output:

13421

result:

ok single line: '13421'

Test #5:

score: 20
Accepted
time: 72ms
memory: 330600kb

input:

1000 1000
a
aabbab
bbbbababbbba
bb
baaaaa
ba
a
baa
a
bbaaaabaaaba
ba
a
a
a
bbababbbbbb
b
aaabb
bbbbbaabbabab
bbaaa
aaaa
aa
aaaaaababb
a
bbaba
baaa
aabbab
babaab
b
aab
bbbabb
aaaabbbbbaaaaaa
bbbbbbbaabab
bb
ab
aaa
aaababb
babaaaabab
aa
aaabaaababa
abbabaaaaabb
bbaa
abaabb
baa
abba
aaaa
abbbb
aab
b
aa...

output:

3159935

result:

ok single line: '3159935'

Subtask #2:

score: 30
Accepted

Test #6:

score: 30
Accepted
time: 951ms
memory: 740604kb

input:

1 10000
bcacacbcdadbcbccbdddaaddabcaccccbaabbcdcdaabdacccadacbbbabdaaacadacdccadcbdadadcaaabdbdbdcdcccbacbdbccacbdadcaaaacbabdadcacdcacadcadaabdaaabccccdcbcdbcadcaabbbaacaadaccdaccadbddcdbccbcddcaadcaadaadbbaadbcdbddbcbadbccbaddaacabcdccbadaddcadcbababccabcaadbcbdbcbbcdcbdbcdbdaaddbacddcabbbdccbddba...

output:

1160913325

result:

ok single line: '1160913325'

Test #7:

score: 30
Accepted
time: 722ms
memory: 721860kb

input:

1 1000
caaadbacdaaccbdcaccbdbddcdaccaaaaaccdccaadbadbcdccaacdadcccaddadcbacbbdcaadbbcdaddcadddccdbabccdadcaacabcabbbdbbbbdbbaaccddcdddcddddddbdbbadbddcbacdcdbdabcbbdbbaaadbdacaccdbaaabacbacabdaccaabaadddccbabacdbdddbdcadadcdccabaabbccbacddddcbcdbabaadaddbbdabadaccbdbaaabdadadaadabbdbadacacbdcbcbdccc...

output:

134272327

result:

ok single line: '134272327'

Test #8:

score: 30
Accepted
time: 976ms
memory: 737332kb

input:

1 10000
bbcbcaacaaaacacbacacbaacbacbaababaacacbacbacbccaacbbacbbccababcaaaccabaaccbbbaaaabbababaacbbccabcaccaaccbacccaacabcaacacaccababbbbbcbacaaabbcbaccacaaaaabbacbbcbbcabccaabcabcabaabbbabbababbabcacbcaccabacaababbacccabbcaaacacccbcbcccbbbbaababbabcaaabaccccbbbabccabacbcbabccccaccbcccccbcccccccbbc...

output:

1375114968

result:

ok single line: '1375114968'

Test #9:

score: 30
Accepted
time: 1037ms
memory: 737272kb

input:

1 10000
cbaacaaaaccacaacbbcacabccbbabbababbababbacbababbcabcbacabbaaaacccacbbaaacacbacccbababaabccbbcabbbcaacbcbbbcbcbccccbabcacccccaabbbccacccacabccbcccbaaaccbbbacbaabbcbaabccccaabacabccaaccbbbaccbbcbcaabcaacbcbbcacbcbcabbacbababcbcabcbaabbbbbcccccbcacbabbcccccaacccbaccbaacbccbcababbabcbbccbbbbacab...

output:

1363955024

result:

ok single line: '1363955024'

Test #10:

score: 30
Accepted
time: 1041ms
memory: 738700kb

input:

1 10000
aacbabccacabcccbccbbcacbbcbcacbbcacbbcbcacacbaaabbbbccaabcbbccccaccccbbcbbcacbbcbbcacbbcbcacacbaaabbbbccaabcbbccccaccccbbcbcbbccccaccccbbbccccaccccbbcbcbbccccaccccbbcbaaccbbbbaaaaabbbbccaabcbbccccaccccbbcbcbbccccaccccbbbccccaccccbbcbcbbccccaccccbbcbaaccbbbbaaabcacacbcbbcacbbcacacbaaabbbbccaa...

output:

1951994915

result:

ok single line: '1951994915'

Test #11:

score: 30
Accepted
time: 1275ms
memory: 734384kb

input:

1 10000
bbaabbaaaabbbaaabbbaabaabaababbbbbabaabbababaaabbbbbbabbaaaabbbbbbaabababbbbabbaababbbbabaabaabaaabbabababbbbbaabababbaabbabbbababbbabaaaaabaaaaaaabaabaaabababbbabbabbaaaabababbbbabaabbaaababbaabbbbabbabbabbabbabaababaaaabbbaabbaababbabbbbaaaaaaaaaababbbbabbbabbaabbbbaaabaabbbbbaabbaababbaba...

output:

424739578

result:

ok single line: '424739578'

Subtask #3:

score: 20
Accepted

Test #12:

score: 20
Accepted
time: 675ms
memory: 681092kb

input:

100 1000
abbabbbbabbbbabaabaabbbbabaaabbbaabaabbabaabaabbaabbaabbababbabbababbbaabaabbaabbbabaabbbaaaabaaaabaababbaaaaaaaaabaabbaababbbbbbabbbabbbbababbbaaaaaabaaaabaaabbabbaaaaabbbabbabaabbabababbaaababbbaaaabbabbbabbabbabbbbbbabaabaabbbaabaaabbaabbabbbbaabbabaaabaabaabbbabbbbbabaababbbabababaabbba...

output:

1289287

result:

ok single line: '1289287'

Test #13:

score: 20
Accepted
time: 798ms
memory: 699288kb

input:

1000 1000
babbbabaabaaaabbbbbababaaabbaabbbbbabbaababbbbaaabbbbaaabbbababbaaaabaaabbbbbbbbaabbabbbabbabbaaabaabbbbbbbababaabbbbabaaabbaaaaabbbaababbaaaaabbbbaaaabbbaabaaababaaabbabbbabbabbbabbaabbabbbabaaaaaabaabbabbababbbbbabaaabbbbababbbaabbbaaabbababaababbbbbaaabbbabbabaaaababbbaabaaaabbbabaaabbb...

output:

10431998

result:

ok single line: '10431998'

Test #14:

score: 20
Accepted
time: 1399ms
memory: 713312kb

input:

1000 10000
babbababbbaaaaaaaaababbabbbababbbbbbbbabaaaaaabbaababbbbbbbaaaabbaaaaabbbbbbbababbabaaaaabbaaabaaaaaaabbbabbabbaaabbbabbbbababababbabbababbabbbbaabbbbaababbaababbababbbaaabbbbaaabaaaabababbbbaabaababbabbbaabbbbbabbbaaabaabaabbaabaaaaabbabbbbaaabbabbbaababbbaabaaaabbbababbbbbbbabababbaabab...

output:

94347164

result:

ok single line: '94347164'

Test #15:

score: 20
Accepted
time: 1909ms
memory: 798640kb

input:

10000 10000
bbbabbaababbbbbababbbbaabbabaaaababbabbbabababaaaaaababbbaabaabbababbbbbaa
b
aaabbbbbbabbaabbbbbbaabaaababbbabbabaaabababbababaaabbaabaabaabbbbabb
abbaabbaababbbabaabababaaaaaaaabaabbbb
bbbbbabbaabbaaaabaabaababbbababbbbbaaaabbabbbabbaabbbabaaababababaabbaaaabaabbaaabbbaaaaaababababbbabb...

output:

694099162

result:

ok single line: '694099162'

Test #16:

score: 20
Accepted
time: 744ms
memory: 660224kb

input:

100 100
ababababbbababbabbaabbbbbaabaaaaabbabaaaaabbbaabbbabababbbaaaaababbaabbbababaababbaabbaaababaabbaabbbbbbaaababbbaabaaaababbaababbbaaaabbbbaababaabaabaaabaaaabaababaaababbbbabbaabbbbababbaaabaaabaabaabaaaabaaaabbbbbabaaaabababaaababbbbbabbaaaabbbaaaaaaabababbaaababbbabbbbbaaaaaaaaaabbaabababa...

output:

138444

result:

ok single line: '138444'

Subtask #4:

score: 30
Accepted

Test #17:

score: 30
Accepted
time: 668ms
memory: 679964kb

input:

100 1000
bcbccabbbabacabaabbccbaaabbbbcbbbaaaacaaabbccbababbacbbabbbaccccccccbccabcaacbbccbbbbcaaacabcccaccbaacccbcbaaaccbcaaaaaaaabccaaaacccbabacbcababbacbbbcaabaaacbbcaccbaccccbbcbacabaacbcaccacbcbcbbcbccccbbcacccaabbabcaabbacabaaacccbbcbccbabbcbccbcbbbabbaabacbccbacababbacbababbbaacccacbabcabcaba...

output:

833103

result:

ok single line: '833103'

Test #18:

score: 30
Accepted
time: 712ms
memory: 692660kb

input:

1000 1000
cacccababcaaccbaaabcbcabcbbccbcbcbbcacbbcabcaaccabcccaacabccaacaaaababbbbbcbbcbcbbbcacbaabccaccbaacaaacabbbcbcbaabbcccacaababbbabcaabbaabaabaabaabccaacccbabcbaacccbbbccaacbbacacacaacccbcbcbaccbccaaacabaacbcbaacbcbacaccbacbbcaccbabbbabbbaccccbbbcacccccaacbbaaaccacabaaacaccabacacbaaaaacbacab...

output:

6757759

result:

ok single line: '6757759'

Test #19:

score: 30
Accepted
time: 1072ms
memory: 716060kb

input:

1000 10000
cbacbccbcbbcccbbcccaacccbbbacbccaaaccabacaabacccbbbcbabcaacabbabbabcaaaabccbabcaaacaaabbbacccacabcacccaaababcacbaacaccbccbcaaaaaaaaccabbcaaaaabccacaacbccabacabcccaabbcaccbcabbccbabbbccaacbabcbacacabbaaaababbccbcbacbbbcaccaabacbcaabbaaacaacccaaabbbcabbbcccacacaccaacbccabccbcacbbbbbabcbabbc...

output:

61388196

result:

ok single line: '61388196'

Test #20:

score: 30
Accepted
time: 1342ms
memory: 766684kb

input:

10000 10000
aababaaccbcbabaccbaccbcaaabbcbbbbacbcbababbccbccbbac
cbcccccacaccabcbbbaaabcaaccabccccccbabacbbabbaaacbabccbcaacacbbbabbbbcbbcbcbaaccaccbabccabbbbbabcabcbcccababbcabaccbbccbaaacaabacbcbcbbabbcbaabcaccaaaccbbcacaaabcabacabccbaabbacabccacbabbaababb
cacbcbabc
caacccaabaaccbbbabaababbbbcbcac...

output:

462062051

result:

ok single line: '462062051'

Test #21:

score: 30
Accepted
time: 622ms
memory: 657876kb

input:

100 100
abcababbbbbcaccccbcacacabbccccbbccacbbabacabbbbacacaacaaabbcaabcaaaaabaaccbaaacbbcbbcabbaaababacabcccaabbcbbbbaaaacaabbbacbcabacbbccbbacacbaaabacabbcbbcaabaccababccaaababbcbcacbabababcbcccccccababcbbbaaabbacbaabbaababcabaacbccacbbaccbbbbcbbabbccaacbaccaaabaccbaacaaaaabbcaccbbbaaccaaccccbbbaa...

output:

90325

result:

ok single line: '90325'

Test #22:

score: 30
Accepted
time: 533ms
memory: 590260kb

input:

430 800
aaaccaccaacbcccbccbccaaaaaabccabbcbccabcacbcaabcbacbccbbacccaccabccacbbcccccbacaacbabbbaaaaacbbbcabacbccaabcabcbacccacbabaacacbcaacbabbabbbbbaacacabbaccaabcccbacbbabccccccbabbaaaaababcababaabcaabbcbbaaccaccabbaabcabccbbcbacacaaabcbaaccccbcbacbccacaaacbbaabaabccabaacbccccbbbbcabccbbcbbcbccaba...

output:

157989035

result:

ok single line: '157989035'

Test #23:

score: 30
Accepted
time: 758ms
memory: 607308kb

input:

400 400
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

40039936

result:

ok single line: '40039936'

Test #24:

score: 30
Accepted
time: 3700ms
memory: 1429812kb

input:

400 400
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbabaaaaabbbbaabbb...

output:

108484268

result:

ok single line: '108484268'