QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#622748#7780. Dark LaTeX vs. Light LaTeXCatreapAC ✓868ms376144kbC++179.2kb2024-10-09 01:55:302024-11-25 21:16:10

Judging History

This is the latest submission verdict.

  • [2024-11-25 21:16:10]
  • 自动重测本题所有获得100分的提交记录
  • Verdict: AC
  • Time: 868ms
  • Memory: 376144kb
  • [2024-11-25 20:53:52]
  • hack成功,自动添加数据
  • (/hack/1258)
  • [2024-10-09 01:55:31]
  • Judged
  • Verdict: 100
  • Time: 876ms
  • Memory: 457992kb
  • [2024-10-09 01:55:30]
  • Submitted

answer

#include <algorithm>
#include <cstdio>
#include <cstring>
#include <map>
#include <vector>

typedef long long ll;

const int N = 5005;

const int B1 = 7393, B2 = 2333;
const int M1 = 998244353, M2 = 1e9 + 7;

void build(char* str, int n, std::pair<int, int>* h) {
    h[0] = {0, 0};
    for (int i = 1; i <= n; i++) {
        h[i].first = ((ll)h[i - 1].first * B1 + str[i]) % M1;
    }
    for (int i = 1; i <= n; i++) {
        h[i].second = ((ll)h[i - 1].second * B2 + str[i]) % M2;
    }
}

std::pair<int, int> calc(std::pair<int, int>* h, int l, int r) {
    static int pow1[N], pow2[N];
    if (!pow1[0]) {
        pow1[0] = pow2[0] = 1;
        for (int i = 1; i < N; i++) {
            pow1[i] = (ll)pow1[i - 1] * B1 % M1;
        }
        for (int i = 1; i < N; i++) {
            pow2[i] = (ll)pow2[i - 1] * B2 % M2;
        }
    }
    return {((ll)h[r].first - (ll)h[l - 1].first * pow1[r - l + 1] % M1 + M1) % M1,
            ((ll)h[r].second - (ll)h[l - 1].second * pow2[r - l + 1] % M2 + M2) % M2};
}

void calcZ(char *s, int n, int *z) {
    for (int i = 1, l = 0, r = 0; i < n; ++i) {
        if (i <= r && z[i - l] < r - i + 1) {
            z[i] = z[i - l];
        } else {
            z[i] = std::max(0, r - i + 1);
            while (i + z[i] < n && s[z[i]] == s[i + z[i]])
                ++z[i];
        }
        if (i + z[i] - 1 > r)
            l = i, r = i + z[i] - 1;
    }
}

void calcNext(char *s, int n, int *nxt) {
    for (int i = 1, j = 0; i < n; i++) {
        while (j && s[i + 1] != s[j + 1]) {
            j = nxt[j];
        }
        if (s[i + 1] == s[j + 1]) {
            j++;
        }
        nxt[i + 1] = j;
    }
}

int main() {
    static char s[N], t[N];
    static int zs[N][N], zt[N][N];
    static int ns[N][N], nt[N][N];
    static int sum[N][N];
    static ll tmp[N];
    static bool vis[N];
    // std::map<std::pair<int, int>, int> mp_s, mp_t;
    // static std::pair<int, int> hs[N], ht[N];
    scanf("%s%s", s + 1, t + 1);
    int n = strlen(s + 1), m = strlen(t + 1);
    ll ans = 0;
    /*
    build(s, n, hs);
    build(t, m, ht);
    for (int i = 1; i <= n; i++) {
        for (int j = i; j <= n; j++) {
            mp_s[calc(hs, i, j)]++;
        }
    }
    for (int i = 1; i <= m; i++) {
        for (int j = i; j <= m; j++) {
            mp_t[calc(ht, i, j)]++;
        }
    }
    */
    for (int i = 1; i <= n; i++) {
        calcZ(s + i, n - i + 1, zs[i]);
        calcNext(s + i - 1, n - i + 1, ns[i]);
        // printf("zs[%d] = ", i);
        for (int j = 2; i + j <= n; j++) {
            if (zs[i][j]) {
                sum[i + j - 1][i + 1]++;
                sum[i + j - 1][std::min(i + j, i + zs[i][j] + 1)]--;
            }
            // printf("%d ", zs[i][j]);
        }
        // printf("\n");
        /*
        printf("nxt[%d] =", i);
        for (int j = 1; i + j <= n + 1; j++) printf("%d ", ns[i][j]);
        printf("\n");*/
    }
    for (int j = 2; j < n; j++) {
        // printf("sum[%d] = ", j);
        for (int i = 1; i <= n; i++) {
            sum[j][i] += sum[j][i - 1];
            // printf("%d ", sum[j][i]);
        }
        // printf("\n");
        /*
        for (int i = 2; i <= j; i++) {
            auto it = mp_t.find(calc(hs, i, j));
            if (it != mp_t.end()) {
                ans += (ll)sum[j][i] * (it->second);
            }
        }
        */
        // printf("ans = %d\n", ans);
    }
    auto getns = [&](auto &&self, int l, int i) -> ll {
        if (i == 0) {
            return 0;
        }
        if (vis[i]) {
            return tmp[i];
        }
        vis[i] = true;
        return tmp[i] = (ll)sum[l + i - 1][l] + self(self, l, ns[l][i]);
    };
    auto getnm = [&](auto &&self, int l, int i) -> ll {
        if (i == 0) {
            return 0;
        }
        if (vis[i]) {
            return tmp[i];
        }
        vis[i] = true;
        return tmp[i] = 1ll + self(self, l, ns[l][i]);
    };
    auto getnt = [&](auto &&self, int l, int i) -> ll {
        if (i == 0) {
            return 0;
        }
        if (vis[i]) {
            return tmp[i];
        }
        vis[i] = true;
        return tmp[i] = (ll)sum[l + i - 1][l] + self(self, l, nt[l][i]);
    };
    for (int l = 2; l < n; l++) {
        memset(vis, 0, sizeof(vis));
        memset(tmp, 0, sizeof(tmp));
        for (int i = 0, p = 0; i < m; i++) {
            while (p && t[i + 1] != s[l + p]) {
                p = ns[l][p];
            }
            // printf("--%d %d %d \n", l, p, i);
            if (t[i + 1] == s[l + p]) {
                ans += getns(getns, l, p + 1);
                /*
                ans += (ll)sum[l + p][l];
                // printf("(%d, %d) = (%d, %d): %d\n", l, l + p, i - p + 1, i + 1, (ll)sum[l + p][l]);
                int pp = ns[l][p + 1];
                while (pp && t[i + 1] == s[l + pp - 1]) {
                    ans += (ll)sum[l + pp - 1][l];
                    // printf("(%d, %d) = (%d, %d): %d\n", l, l + pp, i - pp + 1, i + 1, (ll)sum[l + pp][l]);
                    pp = ns[l][pp];
                }*/
                p++;
                // printf("+ %d %d %d\n", l + p, i, (ll)sum[l + p][l]);
            }
        }
        // printf("ans[%d] = %d\n", l, ans);
    }
    /*
    for (int i = 1; i <= n; i++) {
        for (int j = i; j <= n; j++) {
            auto it = mp_t.find(calc(hs, i, j));
            if (it != mp_t.end()) {
                ans += it->second;
            }
        }
    }*/
    // for (int l = 1; l <= n; l++) {
    //     for (int i = 0, p = 0; i < m; i++) {
    //         while (p && t[i + 1] != s[l + p]) {
    //             p = ns[l][p];
    //         }
    //         if (t[i + 1] == s[l + p]) {
    //             p++;
    //             ans++;
    //             printf("(%d, %d) = (%d, %d): %d\n", l, l + p, i - p, i, 1);
    //         }
    //     }
    // }
    for (int l = 1; l <= n; l++) {
        memset(vis, 0, sizeof(vis));
        memset(tmp, 0, sizeof(tmp));
        for (int i = 0, p = 0; i < m; i++) {
            while (p && t[i + 1] != s[l + p]) {
                p = ns[l][p];
            }
            // printf("--%d %d %d \n", l, p, i);
            if (t[i + 1] == s[l + p]) {
                ans += getnm(getnm, l, p + 1);
                /*
                ans += 1;
                // printf("(%d, %d) = (%d, %d): %d\n", l, l + p, i - p + 1, i + 1, 1);
                int pp = ns[l][p + 1];
                while (pp && t[i + 1] == s[l + pp - 1]) {
                    ans += 1;
                    // printf("(%d, %d) = (%d, %d): %d\n", l, l + pp, i - pp + 1, i + 1, 1);
                    pp = ns[l][pp];
                }
                */
                p++;
                // printf("+ %d %d %d\n", l + p, i, (ll)sum[l + p][l]);
            }
        }
        // printf("ans[%d] = %d\n", l, ans);
    }
    // printf("ans = %d\n", ans);
    memset(sum, 0, sizeof(sum));
    for (int i = 1; i <= m; i++) {
        calcZ(t + i, m - i + 1, zt[i]);
        calcNext(t + i - 1, m - i + 1, nt[i]);
        // printf("zt[%d] = ", i);
        for (int j = 2; i + j <= m; j++) {
            if (zt[i][j]) {
                sum[i + j - 1][i + 1]++;
                sum[i + j - 1][std::min(i + j, i + zt[i][j] + 1)]--;
            }
            
            // printf("%d ", zt[i][j]);
        }
        /*
        printf("nxt[%d] = ", i);
        for (int j = 1; i + j <= m + 1; j++) printf("%d ", nt[i][j]);
        printf("\n");*/
        // printf("\n");
    }
    for (int j = 2; j < m; j++) {
        // printf("sum[%d] = ", j);
        for (int i = 1; i <= m; i++) {
            sum[j][i] += sum[j][i - 1];
            // printf("%d ", sum[j][i]);
        }
        // printf("\n");
        /*
        for (int i = 2; i <= j; i++) {
            auto it = mp_s.find(calc(ht, i, j));
            if (it != mp_s.end()) {
                ans += (ll)sum[j][i] * (it->second);
            }
        }*/
        // printf("ans = %d\n", ans);
    }

    for (int l = 2; l < m; l++) {
        memset(vis, 0, sizeof(vis));
        memset(tmp, 0, sizeof(tmp));
        for (int i = 0, p = 0; i < n; i++) {
            while (p && s[i + 1] != t[l + p]) {
                p = nt[l][p];
            }
            if (s[i + 1] == t[l + p]) {
                ans += getnt(getnt, l, p + 1);
                /*
                ans += (ll)sum[l + p][l];
                // printf("(%d, %d) = (%d, %d): %d\n", l, l + p, i - p + 1, i + 1, (ll)sum[l + p][l]);
                int pp = nt[l][p + 1];
                while (pp && s[i + 1] == t[l + pp - 1]) {
                    ans += (ll)sum[l + pp - 1][l];
                    // printf("(%d, %d) = (%d, %d): %d\n", l, l + pp, i - pp + 1, i + 1, (ll)sum[l + pp][l]);
                    pp = nt[l][pp];
                }*/
                p++;
            }
        }
        // printf("ans[%d] = %d\n", l,  ans);
    }
    printf("%lld\n", ans);
    return 0;
}
/*
abab
abaaab
zs[1] = 0 2 0 
zs[2] = 0 1 
zs[3] = 0 
zs[4] = 
zt[1] = 0 1 1 2 0 
zt[2] = 0 0 0 1 
zt[3] = 2 1 0 
zt[4] = 1 0 
zt[5] = 0 
zt[6] = 
*/

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
time: 4ms
memory: 106196kb

input:

abab
ab

output:

8

result:

ok 1 number(s): "8"

Test #2:

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

input:

abab
abaaab

output:

29

result:

ok 1 number(s): "29"

Test #3:

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

input:

abcd
abcde

output:

10

result:

ok 1 number(s): "10"

Test #4:

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

input:

aaba
ba

output:

6

result:

ok 1 number(s): "6"

Test #5:

score: 0
Accepted
time: 7ms
memory: 109980kb

input:

babababaaabbaabababbbaabbbababbaaaaa
aaaabbaababbab

output:

1161

result:

ok 1 number(s): "1161"

Test #6:

score: 0
Accepted
time: 495ms
memory: 368548kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

78156256250000

result:

ok 1 number(s): "78156256250000"

Test #7:

score: 0
Accepted
time: 25ms
memory: 154348kb

input:

gzgzggzgzggzggzgzggzgzggzggzgzggzggzgzggzgzggzggzgzggzggzgzggzgzggzggzgzggzgzggzggzgzggzggzgzggzgzggzggzgzggzgzggzggzgzggzggzgzggzgzggzggzgzggzggzgzggzgzggzggzgzggzgzggzggzgzggzggzgzggzgzggzggzgzggzggzgzggzgzggzggzgzggzgzggzggzgzggzggzgzggzgzggzggzgzggzgzggzggzgzggzggzgzggzgzggzggzgzggzggzgzggzgzggz...

output:

60716448

result:

ok 1 number(s): "60716448"

Test #8:

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

input:

mlmllmllmlmllmlmllmllmlmllmlmllmllmlmllmllmlmllmlmllmllmlmllmlmllmllmlmllmllmlmllmlmllmllmlmllmllmlmllmlmllmllmlmllmlmllmllmlmllmllmlmllmlmllmllmlmllmllmlmllmlmllmllmlmllmlmllmllmlmllmllmlmllmlmllmllmlmllmlmllmllmlmllmllmlmllmlmllmllmlmllmllmlmllmlmllmllmlmllmlmllmllmlmllmllmlmllmlmllmllmlmllmlmllml...

output:

60679828

result:

ok 1 number(s): "60679828"

Test #9:

score: 0
Accepted
time: 387ms
memory: 368660kb

input:

vbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbbvbvbbvbvbbvb...

output:

2655796915

result:

ok 1 number(s): "2655796915"

Test #10:

score: 0
Accepted
time: 392ms
memory: 368256kb

input:

ttdtdttdttdtdttdtdttdttdtdttdtdttdttdtdttdttdtdttdtdttdttdtdttdtdttdttdtdttdttdtdttdtdttdttdtdttdttdtdttdtdttdttdtdttdtdttdttdtdttdttdtdttdtdttdttdtdttdttdtdttdtdttdttdtdttdtdttdttdtdttdttdtdttdtdttdttdtdttdtdttdttdtdttdttdtdttdtdttdttdtdttdttdtdttdtdttdttdtdttdtdttdttdtdttdttdtdttdtdttdttdtdttdttdt...

output:

2652657341

result:

ok 1 number(s): "2652657341"

Test #11:

score: 0
Accepted
time: 396ms
memory: 368796kb

input:

uupuupupuupupuupuupupuupupuupuupupuupuupupuupupuupuupupuupuupupuupupuupuupupuupupuupuupupuupuupupuupupuupuupupuupuupupuupupuupuupupuupupuupuupupuupuupupuupupuupuupupuupupuupuupupuupuupupuupupuupuupupuupuupupuupupuupuupupuupupuupuupupuupuupupuupupuupuupupuupupuupuupupuupuupupuupupuupuupupuupuupupuupu...

output:

2619083676

result:

ok 1 number(s): "2619083676"

Test #12:

score: 0
Accepted
time: 22ms
memory: 154728kb

input:

ggxgxggxggxgxggxggxgxggxgxggxggxgxggxgxggxggxgxggxggxgxggxgxggxggxgxggxgxggxggxgxggxggxgxggxgxggxggxgxggxggxgxggxgxggxggxgxggxgxggxggxgxggxggxgxggxgxggxggxgxggxggxgxggxgxggxggxgxggxgxggxggxgxggxggxgxggxgxggxggxgxggxgxggxggxgxggxggxgxggxgxggxggxgxggxggxgxggxgxggxggxgxggxgxggxggxgxggxggxgxggxgxggxggxg...

output:

61227979

result:

ok 1 number(s): "61227979"

Test #13:

score: 0
Accepted
time: 150ms
memory: 252016kb

input:

cwcwwcwwcwcwwcwcwwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwwcwcw...

output:

834307544

result:

ok 1 number(s): "834307544"

Test #14:

score: 0
Accepted
time: 402ms
memory: 367600kb

input:

trtrttrttrtrttrtrttrttrtrttrttrtrttrtrttrttrtrttrttrtrttrtrttrttrtrttrtrttrttrtrttrttrtrttrtrttrttrtrttrtrttrttrtrttrttrtrttrtrttrttrtrttrttrtrttrtrttrttrtrttrtrttrttrtrttrttrtrttrtrttrttrtrttrtrttrttrtrttrttrtrttrtrttrttrtrttrttrtrttrtrttrttrtrttrtrttrttrtrttrttrtrttrtrttrttrtrttrttrtrttrtrttrttrtr...

output:

2663862697

result:

ok 1 number(s): "2663862697"

Test #15:

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

input:

gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg...

output:

0

result:

ok 1 number(s): "0"

Test #16:

score: 0
Accepted
time: 286ms
memory: 368224kb

input:

igkkcgocckgoocioiiggcgkigoggkociciigokikkcogkoookkiioikockoigokigiiciikcokoockgiiiogicgkkgoiogcggcgckgikccgcckoocgggogiccgkgcoccckgiooiogckoioiioogiicogkckgiickooiockogkoikogkkociioigocoiioccggkigciigcckkggiccciiiggkcgggcokookogiokoccccgogkcigokkckccoccgkoogokogkcioockkikigokiikkkoikiigckkooioogioio...

output:

1707132

result:

ok 1 number(s): "1707132"

Test #17:

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

input:

jkkkjjjkjkkkjjjjkkkkkjjjjjjkjjjjkjjjkkkjkjkkkkjjkkjjjkjkjjjkkkkjkjjkkkkkkkjkkkjkkjkkjjkkjjkjjjkkkjkjjkjkjjjjkkjjjjjjkkjjjkkkjkjkkkkkjkjjkjjkkkkkkkkjkkkjjkjjkkkjkjjkjjkkjjkkkkkjjjjjjkjjjkkjkjjkjjjkjkkjkjkkkkjjkkjkkjkkkjkkkkkkkjkjjkkjkjjkjkkkkkkkjkkjkkkkjkjkkkkkkkjkkjjkjjjkjjkkkkjkjkkjjjjjkjkjjjjkjkkk...

output:

2954810

result:

ok 1 number(s): "2954810"

Test #18:

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

input:

juxqlncuflculraueufcupffalouceftcepluhuupphohougacfftcrouohhnxopoguocjlpqpgppuhllpsnllqnftprunnucfcucclcplxuatfxtnljnuxnhapanlrpuexuflusncrapcrqpoganppxlloougftptxutfcrgchspahqghstuuefntfuauohlxlenpujeupuucnljxuunanustpuppllelnjcupqppaorpexophphnaopsxajtonupocuuoffpuqagutpuntfloalhrffhlrltghulpuoqop...

output:

40401

result:

ok 1 number(s): "40401"

Test #19:

score: 0
Accepted
time: 229ms
memory: 368884kb

input:

lmvbtqzhgzztvlsvzdesvgefvzkqfbvszmqjsgthnmhtifhztvhihdvgeqmhvzzqmqjhdmmteshvjbgvsfzgkivmvggvzbvzlemnmqhvqfmkmvmqhfqeehqvkgsedzmgbheeielzqzqtfzzvvjfievbzhdkfivhksmzbegkzsilnzgnzbqeqtghdzljvvfedmkeivmnzznhfhekvzeqvvfvqzehdhvsmklbzhhfzdtzqlmhehqqvkbqmvlzvmlzmzdzdbvmmmzimmqvleggmzigqmivqzqhvkezgmjvvivvg...

output:

1421341

result:

ok 1 number(s): "1421341"

Test #20:

score: 0
Accepted
time: 40ms
memory: 154224kb

input:

cccfcccffcffffffcfffffccffffffcccffffcffccfcffcfcfffcfcffcfcfcccccccfcffcfccccccffcccfcccfcccccccffcffffffcfccffcccfcfccfcffcfffccffccfffffccfcffcffffffffccfffffffccffcfccfcfcfffccfffffccccfcfccfccfcfcfccccfcccffccccfcccfccccfcfcffcccffcfffcfcccccffccfcccccccfffcffcccccccccccccfcfcffcffcffcffcffcfcf...

output:

3118221

result:

ok 1 number(s): "3118221"

Test #21:

score: 0
Accepted
time: 868ms
memory: 369672kb

input:

srrsrssrrsssrsrsrsrrrrrssrrssrsrsssrrrrsssrrsrrrsrrrrssrsssrssrrrsrrsrsssssrrrrrrrrrrsrrssrsrrrrrsssrrrrsssrsrrsrsssrrrrrsrrssrrssrrrrsrrsrsrsrrrsrrrrssrrssssrsrrrrsrssrsrsssssssrsrrsrrrrrsrssssrrsssrsssrrrrsssssrsrrrsssrssrrrssrsrsssssrrrssrrrrrsssrrsrrsrrrssrrssrsrsrssssrssssrsrrrsrrssrsrsrsrsrsrr...

output:

75529025

result:

ok 1 number(s): "75529025"

Test #22:

score: 0
Accepted
time: 331ms
memory: 368316kb

input:

onpboooppuaeabbabzpoopnqpopnyrabrrpbyorlebzprboypaprrpabebdobozuborppyualtbzauprrobnrqbzuzrrbebotqulratlrobaoyztyrpqqroorbyledaropnnploroabtelydozdopabapqubynynubpybptpoopnyrolparqpaoooobbperyuezponoboyuaopbpqpporplbdrooozbybueyrpnpzodrroyarzbpzyprpdpzboaaobpppalllranutyaobbdptrpprzubdbryapbudylbqab...

output:

3326939

result:

ok 1 number(s): "3326939"

Test #23:

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

input:

etweelwwwwwtttweetleettetlwwlltwwettwtwwlttletlwtltwtwelltetteleelelwwttelwleweltewtwllltwweeelwtweweeweetltttwtelteltwtewteetwwtltwetlteettelwtewtlletlltllwtweewletwtwtleewttlellwwteettlwtttwteetwwltwttelltweetttwtelleleetwewlewewewtewtetttweteeweltltelwwlwltlletwlweelelwlwelelettwllwlewleteeteellw...

output:

547040

result:

ok 1 number(s): "547040"

Test #24:

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

input:

wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww...

output:

38791844792

result:

ok 1 number(s): "38791844792"

Test #25:

score: 0
Accepted
time: 141ms
memory: 247172kb

input:

pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp...

output:

4804791846049

result:

ok 1 number(s): "4804791846049"

Test #26:

score: 0
Accepted
time: 404ms
memory: 376144kb

input:

jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj...

output:

10043476749324

result:

ok 1 number(s): "10043476749324"

Test #27:

score: 0
Accepted
time: 288ms
memory: 310144kb

input:

yhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyyhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyyhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyyhhyhyyhhyyh...

output:

269398620

result:

ok 1 number(s): "269398620"

Test #28:

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

input:

yhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyyhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyyhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyyhhyhyyhhyyh...

output:

269769773

result:

ok 1 number(s): "269769773"

Test #29:

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

input:

baababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaababbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaababbabaabbaababbabaababbaabbabaabbaababbaabba...

output:

287077563

result:

ok 1 number(s): "287077563"

Extra Test:

score: 0
Extra Test Passed