QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#5406#2018. 字符串匹配Qingyu100 ✓77ms8792kbC++171.8kb2020-12-09 16:04:332021-12-19 06:16:41

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2021-12-19 06:16:41]
  • 评测
  • 测评结果:100
  • 用时:77ms
  • 内存:8792kb
  • [2020-12-09 16:04:33]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair
typedef long long LL;
typedef pair<int, int> PII;

int n;
char S[1048585];
int zf[1048585];

int ccl[30], ccr[30], ctl, ctr, gtr, sumc, sumg;
int cnt[30];

void solve() {
    scanf("%s", S);
    n = strlen(S);

    int mp = 0;
    zf[0] = 0;

    for (int i = 1; i < n; i ++) {
        if (zf[i - mp] < mp + zf[mp] - i)
            zf[i] = zf[i - mp];
        else {
            zf[i] = max(mp + zf[mp] - i, 0);

            while (i + zf[i] < n && S[i + zf[i]] == S[zf[i]])
                zf[i] ++;

            mp = i;
        }
    }

    rep(i, n) S[i] -= 'a';

    ctl = ctr = 0;
    rep(i, 26) ccl[i] = ccr[i] = 0;
    rep(i, n) {
        ctr -= ccr[S[i]];
        ccr[S[i]] ^= 1;
        ctr += ccr[S[i]];
    }
    gtr = ctr;
    rep(i, 27) cnt[i] = 0;
    sumc = sumg = 0;

    LL ans = 0;
    rep(i, n) {
        if (i >= 2) {
            int maxc = min(zf[i], n - 1 - i) / i + 1;
            ans += 1LL * (maxc / 2) * sumg + 1LL * ((maxc + 1) / 2) * sumc;
        }

        if (i >= 1) {
            cnt[ctl] ++;

            if (ctl <= ctr)
                sumc ++;

            if (ctl <= gtr)
                sumg ++;
        }

        ctl -= ccl[S[i]];
        ccl[S[i]] ^= 1;
        ctl += ccl[S[i]];

        if (ccr[S[i]])
            sumc -= cnt[ctr];

        ctr -= ccr[S[i]];
        ccr[S[i]] ^= 1;
        ctr += ccr[S[i]];

        if (ccr[S[i]])
            sumc += cnt[ctr];
    }

    printf("%lld\n", ans);
}

int main() { 

    int T;
    scanf("%d", &T);

    while (T --)
        solve();

    return 0;
}

详细

Test #1:

score: 4
Accepted
time: 1ms
memory: 5652kb

input:

5
jjjjjjjjjj
lllllllcyg
mgmgmgmgmg
nycqtnycqt
tdutduwyga

output:

30
39
30
20
33

result:

ok 5 tokens

Test #2:

score: 4
Accepted
time: 2ms
memory: 3680kb

input:

5
hhhhhhhhhh
iiiiiiibkw
dgdgdgdgdg
ffffffffyf
ffzffzwsnw

output:

30
39
30
44
36

result:

ok 5 tokens

Test #3:

score: 4
Accepted
time: 2ms
memory: 5724kb

input:

5
rrrrrrrrrr
iiiiiiiwzr
dididididi
wwwwzqcjvv
mbymbyhgpc

output:

30
39
30
28
33

result:

ok 5 tokens

Test #4:

score: 4
Accepted
time: 1ms
memory: 5728kb

input:

5
cccccccccc
lllllllket
tututututu
ccbuxccbux
pnppnpnlwl

output:

30
39
30
26
32

result:

ok 5 tokens

Test #5:

score: 4
Accepted
time: 2ms
memory: 5616kb

input:

5
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuubgmwdgmgwvqvkbcvihsk
qdaaqdaaqdaaqdaaqdaaqdaaqdaaqdaaqdaaqdaaqdaaqdaaqdaaqdaaqdaaqdaaqdaaqdaaqdaaqdaaqdaaqdaaqdaaqdaaqdaa
csqblzrdlnifzdoijirxfuuojcsqblzrdlnifzdoijirxfuuojcsqblzrdlnifzdoijirxfuuojcsqblzrdlnifzdoijirxfuuoj
znznznznznznznznznznznznznznznznkfbetwyznznznznznznznznznznznznznznznznkfbetwyrhkkkeukvhzdutxrflyozd
jmckpfjftnpjmckpfjftnpjmckpfjftnpjmckpfjftnpjmckpfjftnpjmckpfjftnpjmckpfjftnpjmckpfjftnpqotyif...

output:

6590
3585
2313
4359
4486

result:

ok 5 tokens

Test #6:

score: 4
Accepted
time: 2ms
memory: 3636kb

input:

5
llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllsuqtxhunfvotmxfqebwj
rpiarpiarpiarpiarpiarpiarpiarpiarpiarpiarpiarpiarpiarpiarpiarpiarpiarpiarpiarpiarpiarpiarpiarpiarpia
yyexplkvmxjuqzgrsmdaztszfyyexplkvmxjuqzgrsmdaztszfyyexplkvmxjuqzgrsmdaztszfyyexplkvmxjuqzgrsmdaztszf
pjpjckfsxpjpjckfsxpjpjckfsxpjpjckfsxxhmpnpjpjckfsxpjpjckfsxpjpjckfsxpjpjckfsxxhmpnjdzczjwoypatjpdsry
hggoupspxvihggoupspxvihggoupspxvihggoupspxvihggoupspxvihggoupspxvihggoupspxvihggoupspxvitkhamd...

output:

6564
3560
2607
4517
4554

result:

ok 5 tokens

Test #7:

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

input:

5
nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnkvpnzxdkdhjucliujhhl
quegquegquegquegquegquegquegquegquegquegquegquegquegquegquegquegquegquegquegquegquegquegquegquegqueg
aicsiooegbozaohagssdehvjzaicsiooegbozaohagssdehvjzaicsiooegbozaohagssdehvjzaicsiooegbozaohagssdehvjz
ccodrqccodrqccodrqccodrqccodrqccodrqccodrqccodrqccodrqccodrqccodrqccodrqccodrqccodrqccodrqccodrqqgya
zcnpltniguezcnpltniguezcnpltniguezcnpltniguezcnpltniguezcnpltniguezcnpltniguezcnpltniguecbfigx...

output:

6517
3560
2888
4965
4105

result:

ok 5 tokens

Test #8:

score: 4
Accepted
time: 2ms
memory: 5728kb

input:

5
ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppphytnmeyelaxegcuzqkv
joksjoksjoksjoksjoksjoksjoksjoksjoksjoksjoksjoksjoksjoksjoksjoksjoksjoksjoksjoksjoksjoksjoksjoksjoks
yqmqquzipayftwvwjnbqptuhwyqmqquzipayftwvwjnbqptuhwyqmqquzipayftwvwjnbqptuhwyqmqquzipayftwvwjnbqptuhw
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrqrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrqfalpltjziflutujmcjdajkvjganchakinn
qewuwqqrzauqewuwqqrzauqewuwqqrzauqewuwqqrzauqewuwqqrzauqewuwqqrzauqewuwqqrzauqewuwqqrzaushghlp...

output:

6604
3560
2738
4804
4832

result:

ok 5 tokens

Test #9:

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

input:

5
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss...

output:

690923
325466
274377
538726
519032

result:

ok 5 tokens

Test #10:

score: 4
Accepted
time: 2ms
memory: 3604kb

input:

5
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss...

output:

688611
325466
278014
483768
516890

result:

ok 5 tokens

Test #11:

score: 4
Accepted
time: 1ms
memory: 3644kb

input:

5
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr...

output:

690572
325466
282653
400319
517082

result:

ok 5 tokens

Test #12:

score: 4
Accepted
time: 2ms
memory: 3612kb

input:

5
jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj...

output:

689440
325466
278624
464740
501911

result:

ok 5 tokens

Test #13:

score: 4
Accepted
time: 5ms
memory: 3732kb

input:

5
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee...

output:

714173984
606072908
715934994
603558188
714547382

result:

ok 5 tokens

Test #14:

score: 4
Accepted
time: 5ms
memory: 5772kb

input:

5
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv...

output:

713410981
603184777
713761452
714012718
603184777

result:

ok 5 tokens

Test #15:

score: 4
Accepted
time: 8ms
memory: 3920kb

input:

5
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee...

output:

3502305645
3504362490
3495279874
3496151003
2412446034

result:

ok 5 tokens

Test #16:

score: 4
Accepted
time: 4ms
memory: 3952kb

input:

5
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc...

output:

2419023179
3481792643
2416893029
3498851133
2414888013

result:

ok 5 tokens

Test #17:

score: 4
Accepted
time: 4ms
memory: 3960kb

input:

5
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...

output:

2414715183
2414053265
3498760311
2415418741
2412193453

result:

ok 5 tokens

Test #18:

score: 4
Accepted
time: 11ms
memory: 4236kb

input:

5
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu...

output:

14044909130
13758605640
8021703699
4927122703
9489413350

result:

ok 5 tokens

Test #19:

score: 4
Accepted
time: 10ms
memory: 8016kb

input:

5
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss...

output:

14044820948
13781146461
7453935828
4673360128
9488558416

result:

ok 5 tokens

Test #20:

score: 4
Accepted
time: 9ms
memory: 4292kb

input:

5
rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr...

output:

14044830602
13805450160
7984918891
4873659736
9491430029

result:

ok 5 tokens

Test #21:

score: 4
Accepted
time: 9ms
memory: 4248kb

input:

5
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

14044823925
13789617860
7597752918
4978465106
9490927685

result:

ok 5 tokens

Test #22:

score: 4
Accepted
time: 73ms
memory: 8712kb

input:

5
ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss...

output:

903628883069
902178522904
467114641327
305284235317
620652587747

result:

ok 5 tokens

Test #23:

score: 4
Accepted
time: 73ms
memory: 8792kb

input:

5
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq...

output:

903629704237
901055755987
504315438243
304698187610
620653531389

result:

ok 5 tokens

Test #24:

score: 4
Accepted
time: 76ms
memory: 8768kb

input:

5
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc...

output:

904243010503
904253960505
904235088477
667900329073
904248230739

result:

ok 5 tokens

Test #25:

score: 4
Accepted
time: 77ms
memory: 8792kb

input:

5
hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh...

output:

904261912252
904260123920
904263261760
667900331468
904241569561

result:

ok 5 tokens

Extra Test:

score: 0
Extra Test Passed