QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#473035#8521. Pattern Search IIGenshinImpactsFault#AC ✓28ms336072kbC++201.6kb2024-07-11 21:15:372024-07-11 21:15:37

Judging History

你现在查看的是最新测评结果

  • [2024-07-11 21:15:37]
  • 评测
  • 测评结果:AC
  • 用时:28ms
  • 内存:336072kb
  • [2024-07-11 21:15:37]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

#define N 1000010
int pre[31][N], suf[31][N];
int dpp[31][N], dps[31][N];
int fib[31];
string s; int n;

int main()
{
    cin >> s; n = s.length(); s = "0" + s;

    if (n == 1) {cout << "1\n"; return 0;}

    fib[0] = fib[1] = 1;
    for (int i = 2; i <= 30; i ++)fib[i] = fib[i - 1] + fib[i - 2];
    for (int j = 0; j <= 30; j ++) 
    {
        for (int i = 0; i <= n + 1; i ++)dpp[j][i] = dps[j][i] = fib[j];
        dpp[j][0] = dps[j][n + 1] = 0;
        suf[j][n + 1] = n + 1; pre[j][0] = 0;
    }
    for (int i = 1; i <= n; i ++)
    {
        if (s[i] == 'a')
        {
            pre[1][i] = i - 1, suf[1][i] = i + 1;
            pre[0][i] = i, suf[0][i] = i;
        }
        if (s[i] == 'b')
        {
            pre[0][i] = i - 1, suf[0][i] = i + 1;
            pre[1][i] = i, suf[1][i] = i; 
        }
    }

    int ans = int(1e9);

    for (int j = 2; j <= 30; j ++)
    {
        for (int i = 1; i <= n; i ++)
        {
            pre[j][i] = pre[j - 1][pre[j - 2][i]];
            if (pre[j][i] == 0)dpp[j][i] = dpp[j - 1][pre[j - 2][i]] + dpp[j - 2][i];
        }
        for (int i = 1; i <= n; i ++)
        {
            suf[j][i] = suf[j - 2][suf[j - 1][i]];
            if (suf[j][i] == n + 1)dps[j][i] = dps[j - 2][suf[j - 1][i]] + dps[j - 1][i];
        }
        for (int i = 1; i < n; i ++) if(pre[j - 1][i] == 0 && suf[j - 2][i + 1] == n + 1)ans = min(ans, dpp[j - 1][i] + dps[j - 2][i + 1]);
        // cout << j << ' ' << ans << endl;
    }

    cout << ans << '\n';
    return 0;
}

詳細信息

Test #1:

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

input:

aabbaab

output:

8

result:

ok 1 number(s): "8"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3544kb

input:

a

output:

1

result:

ok 1 number(s): "1"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

b

output:

1

result:

ok 1 number(s): "1"

Test #4:

score: 0
Accepted
time: 0ms
memory: 255400kb

input:

aa

output:

2

result:

ok 1 number(s): "2"

Test #5:

score: 0
Accepted
time: 0ms
memory: 255596kb

input:

bb

output:

3

result:

ok 1 number(s): "3"

Test #6:

score: 0
Accepted
time: 0ms
memory: 255572kb

input:

ab

output:

2

result:

ok 1 number(s): "2"

Test #7:

score: 0
Accepted
time: 3ms
memory: 255472kb

input:

ba

output:

2

result:

ok 1 number(s): "2"

Test #8:

score: 0
Accepted
time: 0ms
memory: 255488kb

input:

bbba

output:

7

result:

ok 1 number(s): "7"

Test #9:

score: 0
Accepted
time: 0ms
memory: 255452kb

input:

abbbbbbbab

output:

20

result:

ok 1 number(s): "20"

Test #10:

score: 0
Accepted
time: 0ms
memory: 255632kb

input:

abbbbabbbabbbabbabaabbabb

output:

43

result:

ok 1 number(s): "43"

Test #11:

score: 0
Accepted
time: 4ms
memory: 255472kb

input:

bbbaabaabbbaabababbbabaaabaaabbbaaaabaabaaaaabbabbbababbabaaba

output:

94

result:

ok 1 number(s): "94"

Test #12:

score: 0
Accepted
time: 0ms
memory: 255472kb

input:

ababaaabbaaaabaaaaabbabbbababaabaabbabbabaaaabbbabbaaaabaaaabbbabaaaaabbbbbbbbaabaabaabbbbbbabbaabaaaabbbabbbaaabaaabaababaabbbbbbbbaabababaabbaabbbaaaaabb

output:

245

result:

ok 1 number(s): "245"

Test #13:

score: 0
Accepted
time: 0ms
memory: 255492kb

input:

aaaabbbbaaaaababababaaabbbbbbababbaaaaabaaaaaabababbaabbbabbabbbbabbbabaabaaaabababaabbbaaaaabbbabaabaaaababaabbaaabbbaaaabbbaabbaaabbabbbabbabbaababbbbabbbbbbabbaaabbaabbbbbbabababbaaababbaaaaaaabaabbaabbabbbaaaaaaaaaababbaaaabaabbbabbbaabbabbbaabaaaaaabaababaaaababaaaaaababbaaaaaabaabbaabbbbbbaaba...

output:

625

result:

ok 1 number(s): "625"

Test #14:

score: 0
Accepted
time: 0ms
memory: 257712kb

input:

aabaababbbbbbbbaabaaaaaabbbaababbabbabbaabbaaaaabaaaabbbbababbaabaaaaaabbbbabbbbbbbabbbaababbbbbbabaaababbaabaaaabbaababbbaaabbabababbbbbabbbaaaaaabbaabbbbabbabbaaaaaabababbabbbbabaabbbbbbbbaaabababbbbbbbaaababbbbbbabbbbabbaaabbbbaaabaaabbaabaabbaaaabababbabbabababbbaabbbbbabaaabbbabbbababbaababbbba...

output:

1608

result:

ok 1 number(s): "1608"

Test #15:

score: 0
Accepted
time: 0ms
memory: 255364kb

input:

aaababbbabbaabbbababbaaababaabbbbbabbbabbbabbabbaabbabbabaaabaabbbbbabababbbabaaaabaaababbabaaaabababbaabbaaaaaababaabababbbaaaabbababbbaaaaabababbaaaaabaabbbbbbaabaaaabbbaaababaabbbabaabaaababbbaaaaaabbbbbbbabbbabbaaaababbababaababaabbbbbaaaaabbababbbaabaabbabbaabbbbabaaabbababaaaabbbabaaabaabbbbab...

output:

3954

result:

ok 1 number(s): "3954"

Test #16:

score: 0
Accepted
time: 0ms
memory: 255628kb

input:

aaabbbbabaaabbabbaabbabbbbbbbaaabbaaaaabbbbbaaaabbbaaabbabbaabaabbbaabaababaabbbababbbbbbabbababbbbabaaababbbaaabbabbbaabbbbbbbbbbabbbbbabbabbbbabbbbbbbaabaaaaaabbbaaabaabaaaaabbabbaaabbababaaaaaababbbabaabbbaabaaabaabbabaaaaababaaabbaabaababbaaabaabbaabbbbaababbaabaaabababbbbbabbbbababbbbbbaabbabab...

output:

10033

result:

ok 1 number(s): "10033"

Test #17:

score: 0
Accepted
time: 3ms
memory: 263752kb

input:

aabbbbbabababbbababaaabaabbbbbbaaababaabaababbbbbaabaabababaabbbbbbaabbbababbbbbbbbbbabababbabbaaaabaaaaabbabbbabbaaaaababababaaabbbbbbbabbbbbbbbaaabbbaaababbaaaaaabaabbaababbbabaaabbbaabbabababbaaaababbbabbbabaaaaabbbabbbabbaaaabababbbbbbaabbbaaaabbabbabbabbbbbbbaabbbaabbbbabbbaabbbbbbabaaaabbaaabb...

output:

24882

result:

ok 1 number(s): "24882"

Test #18:

score: 0
Accepted
time: 4ms
memory: 276212kb

input:

bbabaaababbabbbbbbababaababaaabababaabbbaabbbabbababbbbbabbbbaaabbbbaaaaabbaaabbbabbbbaabaabbaaaabaababbbababbbbaaaaabaabaababbbbbabbbabbaaabbabbbbaabbabababababababaabbaabbaabbabaaaabaaabbbbbababbbbaaaaabaababbbbabaaaabababaaabaaaabbbbabbbbabaaaaaababbbbabaaabaaaabaaabaabaabaabaaabbabbbbabbababaaab...

output:

62283

result:

ok 1 number(s): "62283"

Test #19:

score: 0
Accepted
time: 8ms
memory: 297188kb

input:

bbbaabaababbaababbbbbbabbbbbbabaabbaaaaabbabbbbbabbabaabbbbaabaaababaaababbaaabababbabbababbbabaabbbabbabbabaabbbbaabaaabbaaabaaabbaaaaabaababbaabaaaabbbbababaababbabaaabababbaabbabbbabbababaaabbbbbabababbaabbbabaaabbaabaababaabbbaabbbaaabbbbabaabbbaaaabbbababaabbaaabaaababbbaabbbaabbbbbabababbababb...

output:

155673

result:

ok 1 number(s): "155673"

Test #20:

score: 0
Accepted
time: 12ms
memory: 292976kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

121390

result:

ok 1 number(s): "121390"

Test #21:

score: 0
Accepted
time: 11ms
memory: 294568kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

196413

result:

ok 1 number(s): "196413"

Test #22:

score: 0
Accepted
time: 8ms
memory: 290900kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

121392

result:

ok 1 number(s): "121392"

Test #23:

score: 0
Accepted
time: 4ms
memory: 292752kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

196416

result:

ok 1 number(s): "196416"

Test #24:

score: 0
Accepted
time: 8ms
memory: 286856kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

121394

result:

ok 1 number(s): "121394"

Test #25:

score: 0
Accepted
time: 8ms
memory: 292740kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

196419

result:

ok 1 number(s): "196419"

Test #26:

score: 0
Accepted
time: 23ms
memory: 317340kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

196415

result:

ok 1 number(s): "196415"

Test #27:

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

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

317806

result:

ok 1 number(s): "317806"

Test #28:

score: 0
Accepted
time: 12ms
memory: 315368kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

196417

result:

ok 1 number(s): "196417"

Test #29:

score: 0
Accepted
time: 12ms
memory: 315280kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

317809

result:

ok 1 number(s): "317809"

Test #30:

score: 0
Accepted
time: 11ms
memory: 313376kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

196418

result:

ok 1 number(s): "196418"

Test #31:

score: 0
Accepted
time: 8ms
memory: 313420kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

317811

result:

ok 1 number(s): "317811"

Test #32:

score: 0
Accepted
time: 12ms
memory: 331960kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

242701

result:

ok 1 number(s): "242701"

Test #33:

score: 0
Accepted
time: 15ms
memory: 331892kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

392698

result:

ok 1 number(s): "392698"

Test #34:

score: 0
Accepted
time: 15ms
memory: 336072kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

242702

result:

ok 1 number(s): "242702"

Test #35:

score: 0
Accepted
time: 15ms
memory: 331952kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

392700

result:

ok 1 number(s): "392700"

Test #36:

score: 0
Accepted
time: 11ms
memory: 330008kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

242704

result:

ok 1 number(s): "242704"

Test #37:

score: 0
Accepted
time: 12ms
memory: 329888kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

392703

result:

ok 1 number(s): "392703"

Test #38:

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

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

242702

result:

ok 1 number(s): "242702"

Test #39:

score: 0
Accepted
time: 16ms
memory: 335480kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

242583

result:

ok 1 number(s): "242583"

Test #40:

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

input:

abaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaabaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaabaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaabbaaaaaaaaaaaaaaaaaaabaaaaabaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaabaaaaaaabaaaaaaaaaaaaaaaaaaaaaaa...

output:

233809

result:

ok 1 number(s): "233809"

Test #41:

score: 0
Accepted
time: 4ms
memory: 323692kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

392700

result:

ok 1 number(s): "392700"

Test #42:

score: 0
Accepted
time: 23ms
memory: 325800kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

392441

result:

ok 1 number(s): "392441"

Test #43:

score: 0
Accepted
time: 23ms
memory: 329952kb

input:

bbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbabbbbbbbabbbabbbbbbbbbbabbbbbbbbbbbbbaabbbbbbbbbabbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbabbbbaabbbbbbbbbbbbbbbbbbbbbbbbbabbabbbbbabbabbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbaababbbbbbababbabbbbbbbbbbbbbbbbbbbbbbbabbabbbbbbbbbbbbbbbbbbb...

output:

367219

result:

ok 1 number(s): "367219"

Test #44:

score: 0
Accepted
time: 0ms
memory: 255480kb

input:

abaaaabbaabaababaababaabaabbaabaabbabbababbbbaaabbbbbaababbbababbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

output:

180

result:

ok 1 number(s): "180"

Test #45:

score: 0
Accepted
time: 0ms
memory: 255632kb

input:

abbaabbbababbaaabbabbabbbabbabbaabaaaabbbbabbbbbaabaabbaaabbababbbbbaaaaaaababbababbabaabbbbbbbbbbbb

output:

177

result:

ok 1 number(s): "177"

Test #46:

score: 0
Accepted
time: 0ms
memory: 255468kb

input:

aabaabbabaaaaaababbbbbaababaabaabbaaaabaabbababbbabaabaababbababbbbaababaabbaabbbbaabbababaaababbaaaaaabaababbbbababbbbabbababaaaaaabaaababaaababbabaaaabbbabbaababbabbbbbbaababbaabbbabaabaabaaababbabbabbabababaaabbbbaaabbbabbbabbabbbbabbabbbbababbaaabbaaabaababbaabbbaaabaabaaabbabbaabbbbbbabbbaaaabb...

output:

1673

result:

ok 1 number(s): "1673"

Test #47:

score: 0
Accepted
time: 0ms
memory: 255664kb

input:

baababaabaababaaabaabbbababbaaabbaabaaababbbbbaaaaababbbaaaaaaaabaaabbbaabbbbaabbabbabbbabaaaabbaabbaabbababbbbabbbaaabbbaabababababaabbbababaabbbbabbbbbaaaababaabbabbbabaaaabaaaaabaabaabbabbaabaaababbbabaaaabaaaabaaaaabbbbbbabbababaaababbbaabababbbbbbbbbababbbbbababbbabaaaabbabbbabbbabbbbaaaabaabab...

output:

1719

result:

ok 1 number(s): "1719"

Test #48:

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

input:

abbbbbbababaaabbaabbbbaaabbbababbaaabbabbbbaabbbabbbbabbbabbaabbabbbbabaaabbaabbbabbababaaaaabaabbababbbaabbabbbaaaababbbaabbbabaaababaabbabbaabbbabbabbbababbabababbaaaaaaabbabbbbbaabaabbbbaaaaabbaabaabbbbbaaabbbabbaaabbabbaaaaaaaaababbaabbaabbbbbbbbbababaaababababbabbbaabbbabbaabaabbbbbbbbbbbaabaaa...

output:

246836

result:

ok 1 number(s): "246836"

Test #49:

score: 0
Accepted
time: 19ms
memory: 323956kb

input:

aaaaaaabbbaaabbbabbbabbbababababbbbaaabbbbbabbabbbbbaabbaabababbabbaabbbbbbbabbbbabbbabaaababaaabaaaabaaaaabababaabaabaaaaababbbaabbaaabbbabaabbaaabbaabbaaabbbabaabbaaaabbabbbaababbababbbbbbaabbbaaaaabaaababaaaababbbabbaabaabbbbabbabbabbbbbbbababbaababaababbbbbaaabaaaabbaabaaabababbbbabaaabaaaababbb...

output:

246901

result:

ok 1 number(s): "246901"

Test #50:

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

input:

baabbbaaaabbbbbaababbabbaaaaaaaaabaaaabbaaabbabbbbbbbbbaaaaabbbbbababbbbbbbbbbbabbbbabaaabbbbbabbaabbbabababaabbaababbbababaaabbbababaaaaabaaaabababbabaabbbabbbbaabaaaababbaabbbbbabababaabbbbbabbbbbaaabaaababaababbabaabababbbbaabababbabbbabbabbbbababaabaaaabbbabbabaabaabbbabbbaabaabababaaaaaabbbabbb...

output:

246841

result:

ok 1 number(s): "246841"

Test #51:

score: 0
Accepted
time: 16ms
memory: 325796kb

input:

aabbbbaaabbaabaabaabbabbbaaaababaabaaaaababbabbaabbaababbbbabbaaaabbaaaaabaabbaabbbabaaababaabbbbbababbbaababababbbbbbaaaabbbabaaabbbabbbbaababbaabaabbaaababbbababaaabbbbbbaaaabbbaabaaabbbbbaabababaaaaababbabbaabbbbbabbabaabbaaabbbabababbabbababbabbbbbaaabbaaabaabaaabbbaabbbabbaabaaaababbbabbabbaaba...

output:

246720

result:

ok 1 number(s): "246720"

Test #52:

score: 0
Accepted
time: 15ms
memory: 325228kb

input:

baabbaabbbabbabbbbbababbbabbbaababbbabbbbbabbbbbbabbbbbbbabbbaabbbbbbbbbbbbbbbaaaabbbbbbabbbbbabaaabbbbbbbabbbabbbababbbbabbbaaabbbaabbbbbbbabbbbbaabbabbbabbbabababbaababbbbabbabbbbbabbbabbbbbbbbaaabbaababbbbbabbbbbbbbbbabbaabbabbbbbbbbbabbabbababbbabbbabbbabbbbbbbabbbbbbbbbabbbbbbbbbbbbbababbabbbaa...

output:

266491

result:

ok 1 number(s): "266491"

Test #53:

score: 0
Accepted
time: 24ms
memory: 319620kb

input:

bbbbbbbbbbbbbaababbbaababbbbbbbbbabbbbbbbbbbbbabbbbbabbbababbbaabbabbbbbbbbabbbbbabbbbabbbbbbbbbbbabbbbbbabbbbbbabbabaaabbbababbaabbbbbabbbbbbbabababbbbbbbbbabbbbabbabbbaabbbaabbbbabababbbbbabababbabbbbababbbabbabbbababbbbbbbbbababbbbbbbbbababbbbbbbbbbbabbabbbabbbbaabbbbabbbabbbbbbbabbbbbbbabbbbbbba...

output:

266645

result:

ok 1 number(s): "266645"

Test #54:

score: 0
Accepted
time: 19ms
memory: 315500kb

input:

bbbbbbbabbbbabbbbbbabbbaaabbabaabbabbbbbbbbabbbaaaabbbbabbbabababbbbbbbbbbbabbbaabbbbbbbabbbbbbbbbbbbbbabbbaabbbbababbbbbbbabbbaabbabbbabbbabbbaabbaabaabaabbbbaabbbabbbaabbbbabbbbbaabbbaaaaabbbbbbbbabbbbbbaabbbbbababbbabbbbbbbabbbbbbbabbbbbbbabbaababbbbbbbbbbbbabbabbaaaababbbbbabbababbbbabbbabbbbaba...

output:

266745

result:

ok 1 number(s): "266745"

Test #55:

score: 0
Accepted
time: 19ms
memory: 327856kb

input:

babbbbabbbababaababbbbaaaababbbbbbabbaabbbaaaabbbbbabbbbbaababbababbbabbbbbbbbbaabbbaabbabbbbbbbbbbbbbbbaababbbaaaaabbbabbababababbaababbbaaabbbbbbabaabbbabbbbbbababbabbabbabbbaaaabbaababbbabbbbaabbbbaabbbbbbbbbbbbaabbbabbbabbbabbbabbbbbbbbabaaabbabbbbbaababbababbbababbababbbbbbbbaabbababbaaaabbbbbb...

output:

282172

result:

ok 1 number(s): "282172"

Test #56:

score: 0
Accepted
time: 16ms
memory: 323688kb

input:

babbbbbaabbbbabbbbbbbbbbabbabbbbabbbbbbbbbaabbaabbbbbaababbbabbbbbbbbbbbbabbbbbabbbbabbabbabbbbabbabbababbbbbbbbabbbbabbbbbbbbbbbbaababaabbbbbbbbbbbbaabbaabbabbbaaaabbbabababbbbbbbbbabbbbbabbbababbbbbbabbbbbbbbabbbbaaaabbbbaababbbbbbbbabababbbbbbabbbbbabbbbbbbaababaaababbbabbabbababbbabbbbbbbaabbbbb...

output:

305384

result:

ok 1 number(s): "305384"

Test #57:

score: 0
Accepted
time: 16ms
memory: 323760kb

input:

babbbaaabbaabbbbbbabbbaaabbabaabbbbbbbbbbbbbbabbbbbbbaabbbbbbbbbbbbbbbbbbbbbbbbababbabbbbbbbabbbbbbbbbbbbabbbabbbbbbbabbbbabbbbabbbbbbaabbbbbbbabababbbbabbbbbabaaaabbbbabbbbbabbabbbbbbabbbbbabbabbabbbbbbbabbababbbbbbbababbbbbabbbbbbbbabbbabbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbabbababbbbbabbbbbbbbbbbbba...

output:

320836

result:

ok 1 number(s): "320836"

Test #58:

score: 0
Accepted
time: 19ms
memory: 327880kb

input:

babbbabbbabbbaaabbbbababbabbbaababbbbbbaabbbabbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbabbbbababaabbbabbbbbbbbbbbaabbbbbbabbbbbbbbbbbbbbabbbbbbbbbabbbbbbbabbbbbbbbbbbbbabbbbbbbbabbbbbbbbabbbbbbbbaabbbbbbbbbabbbbbbbbbababbbbbbaabbbbbabbbbbbbbbbbaabbbbbbbbbbbbbbabbbbbabbbbbaabbbbbabbbbbbabbbbbbbababbbbb...

output:

332069

result:

ok 1 number(s): "332069"

Test #59:

score: 0
Accepted
time: 23ms
memory: 328044kb

input:

bbbbbabbbabbbbbbbabbbaabbabbbbabbbaababbababbbbbabbbabaabbabbbbbbbababbbbbbbabbbbababaabbbbaababaabbabbabbbbaabbabaaabaabbbbbbbbbbaabaabbbbabaabaaabbbbbbabaabababbbabbbabbbabbbbbbbbabbbbabbbabaaababbaaabaaabbbbbbaabbbbabbbabbababababbaababbaabbbabbbbabaaabbaaabaabbbbbbaabbbabbababbaabbbbabbabbbabbbb...

output:

281875

result:

ok 1 number(s): "281875"

Test #60:

score: 0
Accepted
time: 28ms
memory: 331868kb

input:

bbabbbbbbabbbbbbbbbbbbbbbbbbabbbaabbbabbbbbbbaabaababbbbbaaabbabbbbabbbbaabbbbbabbbbbbbaabbbabbbbbbabbbabbabbabaaabbabaabbbaabbbbbbbbbbaabababaaabbbbbaabbbbabbbbbabbababbabababbbabbbabbbbbabbabbbbaabaabbbbabaabbabbabbbbbbababbbbbabbbbbabaabbbbbbbbabbbabbbbabbbbbbbabbabbabbbbbaababbbbabbbbbbbbbabbbbb...

output:

305753

result:

ok 1 number(s): "305753"

Test #61:

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

input:

babbbabbbabababaabbbabbabbbbbbababbbbbbbbbbabbbbbabababbbbbbabbbbbbbbbbbbbbbabbbbbbbbabbbbababbabbabbaaabaabbbbbbbbabbbbbbbbaabbabbababbbbbbbbbbbabaabbbbbbbbbbbabbbbbababaabbbaabbbbbbbbbabbbbababbaabaababbbbababbbbbabbbbbabbbbbbbbabbbbbbbbabbbaabbbbbbbbbbbbbabbbbbabbbbbabbbababbbbbbbbbbbbbaabbbbbbab...

output:

321150

result:

ok 1 number(s): "321150"

Test #62:

score: 0
Accepted
time: 19ms
memory: 329648kb

input:

bbbbbabbabbbabbbbbbbbabbbbbbabbbbabbbabbbbbbbbbbbbabbbababbbbbbbbbbbbbbbbbbbbbbabbbbbbabbbbabbbbbabbbbbabbbbbbabbbababbbbbbbbbabbbbababaabbbbbbbbbbbbabbbbbbbbbbbabbbbbbababbbbbbbbabbbbabbbbbbbbabbbbbbabbbbabbbabbbbbabbbbbbbbbbbbbbbbabbbbbbabbbababbbbbabbbbabbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbabbba...

output:

331900

result:

ok 1 number(s): "331900"

Test #63:

score: 0
Accepted
time: 15ms
memory: 325792kb

input:

bbbabbbbbbbabbbbbabbababaabbabbbbabbbbbbbbabbbabbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbabbbbabbbbbbabbbbabbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbabbabbbbbabbbbbbbabbbbbbabbbbbbbbbabbbbbbbbbbbbababbbbbbbbbbbbaabbbbbbababbbbbbbbbbbbabbbabbbbbbbbbbbbbaabbbbbbbbbbbbabbbabbbbabbbabbbbbbbbbbabbbbabbbb...

output:

339945

result:

ok 1 number(s): "339945"

Test #64:

score: 0
Accepted
time: 19ms
memory: 325732kb

input:

bbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbabbbbbbbbabbbbbbbbbbabbbababbbbabbbabbbbbbbbbbbabbbbbbbbbbbabbbaabababbbbbbabbbbbbbbbbbbbbabbbbbbbbbbbbabbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbabbbbbbbababbbbbabbabbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbaabbbbbbbbabbbbbbbbba...

output:

346933

result:

ok 1 number(s): "346933"

Test #65:

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

input:

abaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaa...

output:

150000

result:

ok 1 number(s): "150000"

Test #66:

score: 0
Accepted
time: 16ms
memory: 329892kb

input:

babaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaaba...

output:

150000

result:

ok 1 number(s): "150000"

Test #67:

score: 0
Accepted
time: 23ms
memory: 327476kb

input:

ababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaabab...

output:

150001

result:

ok 1 number(s): "150001"

Test #68:

score: 0
Accepted
time: 15ms
memory: 323644kb

input:

baababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababaabababaabaababaababaabaababaabaababaababaa...

output:

151000

result:

ok 1 number(s): "151000"

Test #69:

score: 0
Accepted
time: 15ms
memory: 327764kb

input:

baabaabaaaabaaaaaabbababaaaaabaabbaaaabbaabaababaaaabbaababaabbabaababbaabaababbabaaababaaaabbaabababbaabaaabbabaababababaaabaabaaababaaababaabababaabaababaababaababaabaabaababbaabaaabaabaabbaababbababaaabaaabbaabaabaabaaaabbaaaaababbabababaabaaabaabaabababababbabaaaabaababaabaabababababababaabababa...

output:

199864

result:

ok 1 number(s): "199864"

Test #70:

score: 0
Accepted
time: 15ms
memory: 329920kb

input:

bbaabaababaaabababaababaabababaababababbabababababaabaabbaabababababaaabaaaaabaaababaaabaabababaabaababaaaababaaaabbaaaabaaabbaaabbabababaabbaabaabbaabababaabbaaabbabaabaabababaabbaabaaaabaabababaabaababaabaaabbaababaaaabababababaabaaaababaabaababbabaababaabababaabaababaabababababbababaaabaabaababab...

output:

196473

result:

ok 1 number(s): "196473"

Test #71:

score: 0
Accepted
time: 23ms
memory: 327820kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

346417

result:

ok 1 number(s): "346417"

Extra Test:

score: 0
Extra Test Passed