QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#605401#7780. Dark LaTeX vs. Light LaTeXwyhaoAC ✓1011ms204688kbC++145.0kb2024-10-02 17:03:422024-10-02 17:03:42

Judging History

你现在查看的是测评时间为 2024-10-02 17:03:42 的历史记录

  • [2024-11-25 21:15:08]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:AC
  • 用时:1022ms
  • 内存:204336kb
  • [2024-11-25 20:53:52]
  • hack成功,自动添加数据
  • (/hack/1258)
  • [2024-10-02 17:03:42]
  • 评测
  • 测评结果:100
  • 用时:1011ms
  • 内存:204688kb
  • [2024-10-02 17:03:42]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=5005,P1=998244353,P2=1000000007;
int n,m;
char S[N],T[N];
struct Hash{
    ll v1,v2;
    Hash(int v=0):v1(v),v2(v){}
    Hash(int v1,int v2):v1(v1),v2(v2){}
    Hash& operator+=(const Hash &o){(v1+=o.v1)%=P1;return *this;}
    Hash& operator-=(const Hash &o){(v1+=P1-o.v1)%=P1;return *this;}
    Hash& operator*=(const Hash &o){(v1*=o.v1)%=P1;return *this;}
    friend Hash operator+(Hash a,Hash b){return a+=b;}
    friend Hash operator-(Hash a,Hash b){return a-=b;}
    friend Hash operator*(Hash a,Hash b){return a*=b;}
    friend bool operator==(Hash a,Hash b){return a.v1==b.v1 and a.v2==b.v2;}
    friend bool operator<(Hash a,Hash b){return a.v1<b.v1 or (a.v1==b.v1 and a.v2<b.v2);}
}base(131);
// map<Hash,int>Ma[N],Mb[N];
// Hash ps[N],pt[N],pw[N];
int sa[N][N],sb[N][N];
struct Sam{
    struct node{
        int len,fa;
        int ch[30];
    }data[N<<2];
    int last,tot;
    int fa[N<<2][20],dep[N<<2];
    int va[N<<2],vb[N<<2];
    void init(){
        tot=1;
        data[1].fa=data[1].len=0;
        last=1;
    }
    int add(int c){
        int now=++tot;
        int f=last;last=now;
        data[now].len=data[f].len+1;
        for(;f and !data[f].ch[c];f=data[f].fa){
            data[f].ch[c]=now;
        }
        if(!f){
            data[now].fa=1;
            return now;
        }   
        int p=data[f].ch[c];
        if(data[p].len==data[f].len+1){
            data[now].fa=p;
            return now;
        }
        int q=++tot;
        data[q]=data[p];
        data[q].len=data[f].len+1;
        data[p].fa=data[now].fa=q;
        for(;f and data[f].ch[c]==p;f=data[f].fa){
            data[f].ch[c]=q;
        }
        return now;
    }
    vector<int>G[N<<2];
    bool cmp(int a,int b){
        return dep[a]<dep[b];
    }
    void ddfs(int x){
        // printf("%d %d\n",x,dep[x]);
        fa[x][0]=data[x].fa;
        dep[x]=dep[fa[x][0]]+1;
        for(int p=1;p<=15;p++){
            fa[x][p]=fa[fa[x][p-1]][p-1];
            // printf("%d ",fa[x][p-1]);
        }
        // puts("");
        for(auto y:G[x]) ddfs(y);
        va[fa[x][0]]+=va[x];
        vb[fa[x][0]]+=vb[x];
    }
    void dfs(){
        for(int i=2;i<=tot;i++){
            G[data[i].fa].push_back(i);
        }
        ddfs(1);
    }
    int lca(int x,int y){
        if(dep[x]<dep[y]){
            swap(x,y);
        }
        // printf("%d %d\n",x,y);
        int d=dep[x]-dep[y];
        for(int p=15;p>=0;p--){
            if((d>>p)&1) x=fa[x][p];
        }
        // printf("%d %d\n",x,y);
        if(x==y) return x;
        for(int p=15;p>=0;p--){
            if(fa[x][p]!=fa[y][p]){
                x=fa[x][p];
                y=fa[y][p];
            }
        }
        return fa[x][0];
    }
    int query(int x,int y){
        return data[lca(x,y)].len;
    }
}SAM;
int ra[N],rb[N];
int main(){
    // freopen("ex.in","r",stdin);
    // freopen("ex.our","w",stdout);
    scanf("%s%s",S+1,T+1);
    n=strlen(S+1);
    m=strlen(T+1);
    SAM.init();
    for(int i=1;i<=n;i++){
        ra[i]=SAM.add(S[i]-'a');
        SAM.va[ra[i]]=1;
        // printf("%d %d\n",ra[i],SAM.data[ra[i]].fa);
    }
    SAM.add(26);
    for(int i=1;i<=m;i++){
        rb[i]=SAM.add(T[i]-'a');
        SAM.vb[rb[i]]=1;
    }

    SAM.dfs();

    // pw[0]=Hash(1);
    // for(int i=1;i<N;i++){
    //     pw[i]=pw[i-1]*base;
    // }
    // ps[0]=Hash(0);
    // for(int i=1;i<=n;i++){
    //     ps[i]=ps[i-1]*base+Hash(S[i]);
    // }
    // pt[0]=Hash(0);
    // for(int i=1;i<=m;i++){
    //     pt[i]=pt[i-1]*base+Hash(T[i]);
    // }
    for(int i=1;i<=n;i++){
        for(int j=i+2;j<=n;j++){
            if(S[i]!=S[j]) continue;
            int L=min(j-i,SAM.query(ra[i],ra[j]));
            // printf("%d %d %d\n",ra[i],ra[j],L);
            sa[i+1][j-L]++;
            sa[i+1][j]--;
        }
    }
    for(int i=1;i<=m;i++){
        for(int j=i+2;j<=m;j++){
            if(T[i]!=T[j]) continue;
            int L=min(j-i,SAM.query(rb[i],rb[j]));
            sb[i+1][j-L]++;
            sb[i+1][j]--;
        }
    }

    // for(int len = 1;len<=n;len++){
    //     for(int i=1;i+len-1<=n;i++){
    //         int j=i+len-1;
    //         Ma[len][ps[j]-ps[i-1]*pw[len]]++;
    //     }
    // }
    // for(int len = 1;len<=m;len++){
    //     for(int i=1;i+len-1<=m;i++){
    //         int j=i+len-1;
    //         Mb[len][pt[j]-pt[i-1]*pw[len]]++;
    //     }
    // }
    ll ans=0;
    for(int i=1;i<=n;i++){
        int p = 1;
        for(int j=i;j<=n;j++){
            sa[i][j]+=sa[i][j-1];
            p = SAM.data[p].ch[S[j]-'a'];
            ans += 1ll * (sa[i][j]+1) * SAM.vb[p];
        }
    }
    for(int i=1;i<=m;i++){
        int p=1;
        for(int j=i;j<=m;j++){
            sb[i][j]+=sb[i][j-1];
            p = SAM.data[p].ch[T[j]-'a'];
            ans += 1ll * sb[i][j] * SAM.va[p];
        }
    }
    printf("%lld",ans);
    return 0;
}

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

详细

Test #1:

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

input:

abab
ab

output:

8

result:

ok 1 number(s): "8"

Test #2:

score: 0
Accepted
time: 2ms
memory: 10064kb

input:

abab
abaaab

output:

29

result:

ok 1 number(s): "29"

Test #3:

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

input:

abcd
abcde

output:

10

result:

ok 1 number(s): "10"

Test #4:

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

input:

aaba
ba

output:

6

result:

ok 1 number(s): "6"

Test #5:

score: 0
Accepted
time: 2ms
memory: 14176kb

input:

babababaaabbaabababbbaabbbababbaaaaa
aaaabbaababbab

output:

1161

result:

ok 1 number(s): "1161"

Test #6:

score: 0
Accepted
time: 1011ms
memory: 179484kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

78156256250000

result:

ok 1 number(s): "78156256250000"

Test #7:

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

input:

gzgzggzgzggzggzgzggzgzggzggzgzggzggzgzggzgzggzggzgzggzggzgzggzgzggzggzgzggzgzggzggzgzggzggzgzggzgzggzggzgzggzgzggzggzgzggzggzgzggzgzggzggzgzggzggzgzggzgzggzggzgzggzgzggzggzgzggzggzgzggzgzggzggzgzggzggzgzggzgzggzggzgzggzgzggzggzgzggzggzgzggzgzggzggzgzggzgzggzggzgzggzggzgzggzgzggzggzgzggzggzgzggzgzggz...

output:

60716448

result:

ok 1 number(s): "60716448"

Test #8:

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

input:

mlmllmllmlmllmlmllmllmlmllmlmllmllmlmllmllmlmllmlmllmllmlmllmlmllmllmlmllmllmlmllmlmllmllmlmllmllmlmllmlmllmllmlmllmlmllmllmlmllmllmlmllmlmllmllmlmllmllmlmllmlmllmllmlmllmlmllmllmlmllmllmlmllmlmllmllmlmllmlmllmllmlmllmllmlmllmlmllmllmlmllmllmlmllmlmllmllmlmllmlmllmllmlmllmllmlmllmlmllmllmlmllmlmllml...

output:

60679828

result:

ok 1 number(s): "60679828"

Test #9:

score: 0
Accepted
time: 591ms
memory: 203852kb

input:

vbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbbvbvbbvbvbbvbbvbvbbvbbvbvbbvbvbbvb...

output:

2655796915

result:

ok 1 number(s): "2655796915"

Test #10:

score: 0
Accepted
time: 573ms
memory: 203852kb

input:

ttdtdttdttdtdttdtdttdttdtdttdtdttdttdtdttdttdtdttdtdttdttdtdttdtdttdttdtdttdttdtdttdtdttdttdtdttdttdtdttdtdttdttdtdttdtdttdttdtdttdttdtdttdtdttdttdtdttdttdtdttdtdttdttdtdttdtdttdttdtdttdttdtdttdtdttdttdtdttdtdttdttdtdttdttdtdttdtdttdttdtdttdttdtdttdtdttdttdtdttdtdttdttdtdttdttdtdttdtdttdttdtdttdttdt...

output:

2652657341

result:

ok 1 number(s): "2652657341"

Test #11:

score: 0
Accepted
time: 582ms
memory: 204220kb

input:

uupuupupuupupuupuupupuupupuupuupupuupuupupuupupuupuupupuupuupupuupupuupuupupuupupuupuupupuupuupupuupupuupuupupuupuupupuupupuupuupupuupupuupuupupuupuupupuupupuupuupupuupupuupuupupuupuupupuupupuupuupupuupuupupuupupuupuupupuupupuupuupupuupuupupuupupuupuupupuupupuupuupupuupuupupuupupuupuupupuupuupupuupu...

output:

2619083676

result:

ok 1 number(s): "2619083676"

Test #12:

score: 0
Accepted
time: 30ms
memory: 49004kb

input:

ggxgxggxggxgxggxggxgxggxgxggxggxgxggxgxggxggxgxggxggxgxggxgxggxggxgxggxgxggxggxgxggxggxgxggxgxggxggxgxggxggxgxggxgxggxggxgxggxgxggxggxgxggxggxgxggxgxggxggxgxggxggxgxggxgxggxggxgxggxgxggxggxgxggxggxgxggxgxggxggxgxggxgxggxggxgxggxggxgxggxgxggxggxgxggxggxgxggxgxggxggxgxggxgxggxggxgxggxggxgxggxgxggxggxg...

output:

61227979

result:

ok 1 number(s): "61227979"

Test #13:

score: 0
Accepted
time: 211ms
memory: 128196kb

input:

cwcwwcwwcwcwwcwcwwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwcwwcwwcwcwwcwwcwcw...

output:

834307544

result:

ok 1 number(s): "834307544"

Test #14:

score: 0
Accepted
time: 581ms
memory: 204320kb

input:

trtrttrttrtrttrtrttrttrtrttrttrtrttrtrttrttrtrttrttrtrttrtrttrttrtrttrtrttrttrtrttrttrtrttrtrttrttrtrttrtrttrttrtrttrttrtrttrtrttrttrtrttrttrtrttrtrttrttrtrttrtrttrttrtrttrttrtrttrtrttrttrtrttrtrttrttrtrttrttrtrttrtrttrttrtrttrttrtrttrtrttrttrtrttrtrttrttrtrttrttrtrttrtrttrttrtrttrttrtrttrtrttrttrtr...

output:

2663862697

result:

ok 1 number(s): "2663862697"

Test #15:

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

input:

gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg...

output:

0

result:

ok 1 number(s): "0"

Test #16:

score: 0
Accepted
time: 384ms
memory: 203968kb

input:

igkkcgocckgoocioiiggcgkigoggkociciigokikkcogkoookkiioikockoigokigiiciikcokoockgiiiogicgkkgoiogcggcgckgikccgcckoocgggogiccgkgcoccckgiooiogckoioiioogiicogkckgiickooiockogkoikogkkociioigocoiioccggkigciigcckkggiccciiiggkcgggcokookogiokoccccgogkcigokkckccoccgkoogokogkcioockkikigokiikkkoikiigckkooioogioio...

output:

1707132

result:

ok 1 number(s): "1707132"

Test #17:

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

input:

jkkkjjjkjkkkjjjjkkkkkjjjjjjkjjjjkjjjkkkjkjkkkkjjkkjjjkjkjjjkkkkjkjjkkkkkkkjkkkjkkjkkjjkkjjkjjjkkkjkjjkjkjjjjkkjjjjjjkkjjjkkkjkjkkkkkjkjjkjjkkkkkkkkjkkkjjkjjkkkjkjjkjjkkjjkkkkkjjjjjjkjjjkkjkjjkjjjkjkkjkjkkkkjjkkjkkjkkkjkkkkkkkjkjjkkjkjjkjkkkkkkkjkkjkkkkjkjkkkkkkkjkkjjkjjjkjjkkkkjkjkkjjjjjkjkjjjjkjkkk...

output:

2954810

result:

ok 1 number(s): "2954810"

Test #18:

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

input:

juxqlncuflculraueufcupffalouceftcepluhuupphohougacfftcrouohhnxopoguocjlpqpgppuhllpsnllqnftprunnucfcucclcplxuatfxtnljnuxnhapanlrpuexuflusncrapcrqpoganppxlloougftptxutfcrgchspahqghstuuefntfuauohlxlenpujeupuucnljxuunanustpuppllelnjcupqppaorpexophphnaopsxajtonupocuuoffpuqagutpuntfloalhrffhlrltghulpuoqop...

output:

40401

result:

ok 1 number(s): "40401"

Test #19:

score: 0
Accepted
time: 197ms
memory: 202676kb

input:

lmvbtqzhgzztvlsvzdesvgefvzkqfbvszmqjsgthnmhtifhztvhihdvgeqmhvzzqmqjhdmmteshvjbgvsfzgkivmvggvzbvzlemnmqhvqfmkmvmqhfqeehqvkgsedzmgbheeielzqzqtfzzvvjfievbzhdkfivhksmzbegkzsilnzgnzbqeqtghdzljvvfedmkeivmnzznhfhekvzeqvvfvqzehdhvsmklbzhhfzdtzqlmhehqqvkbqmvlzvmlzmzdzdbvmmmzimmqvleggmzigqmivqzqhvkezgmjvvivvg...

output:

1421341

result:

ok 1 number(s): "1421341"

Test #20:

score: 0
Accepted
time: 32ms
memory: 51488kb

input:

cccfcccffcffffffcfffffccffffffcccffffcffccfcffcfcfffcfcffcfcfcccccccfcffcfccccccffcccfcccfcccccccffcffffffcfccffcccfcfccfcffcfffccffccfffffccfcffcffffffffccfffffffccffcfccfcfcfffccfffffccccfcfccfccfcfcfccccfcccffccccfcccfccccfcfcffcccffcfffcfcccccffccfcccccccfffcffcccccccccccccfcfcffcffcffcffcffcfcf...

output:

3118221

result:

ok 1 number(s): "3118221"

Test #21:

score: 0
Accepted
time: 680ms
memory: 204688kb

input:

srrsrssrrsssrsrsrsrrrrrssrrssrsrsssrrrrsssrrsrrrsrrrrssrsssrssrrrsrrsrsssssrrrrrrrrrrsrrssrsrrrrrsssrrrrsssrsrrsrsssrrrrrsrrssrrssrrrrsrrsrsrsrrrsrrrrssrrssssrsrrrrsrssrsrsssssssrsrrsrrrrrsrssssrrsssrsssrrrrsssssrsrrrsssrssrrrssrsrsssssrrrssrrrrrsssrrsrrsrrrssrrssrsrsrssssrssssrsrrrsrrssrsrsrsrsrsrr...

output:

75529025

result:

ok 1 number(s): "75529025"

Test #22:

score: 0
Accepted
time: 243ms
memory: 204160kb

input:

onpboooppuaeabbabzpoopnqpopnyrabrrpbyorlebzprboypaprrpabebdobozuborppyualtbzauprrobnrqbzuzrrbebotqulratlrobaoyztyrpqqroorbyledaropnnploroabtelydozdopabapqubynynubpybptpoopnyrolparqpaoooobbperyuezponoboyuaopbpqpporplbdrooozbybueyrpnpzodrroyarzbpzyprpdpzboaaobpppalllranutyaobbdptrpprzubdbryapbudylbqab...

output:

3326939

result:

ok 1 number(s): "3326939"

Test #23:

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

input:

etweelwwwwwtttweetleettetlwwlltwwettwtwwlttletlwtltwtwelltetteleelelwwttelwleweltewtwllltwweeelwtweweeweetltttwtelteltwtewteetwwtltwetlteettelwtewtlletlltllwtweewletwtwtleewttlellwwteettlwtttwteetwwltwttelltweetttwtelleleetwewlewewewtewtetttweteeweltltelwwlwltlletwlweelelwlwelelettwllwlewleteeteellw...

output:

547040

result:

ok 1 number(s): "547040"

Test #24:

score: 0
Accepted
time: 17ms
memory: 49328kb

input:

wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww...

output:

38791844792

result:

ok 1 number(s): "38791844792"

Test #25:

score: 0
Accepted
time: 295ms
memory: 129904kb

input:

pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp...

output:

4804791846049

result:

ok 1 number(s): "4804791846049"

Test #26:

score: 0
Accepted
time: 597ms
memory: 203076kb

input:

jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj...

output:

10043476749324

result:

ok 1 number(s): "10043476749324"

Test #27:

score: 0
Accepted
time: 325ms
memory: 173308kb

input:

yhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyyhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyyhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyyhhyhyyhhyyh...

output:

269398620

result:

ok 1 number(s): "269398620"

Test #28:

score: 0
Accepted
time: 336ms
memory: 176824kb

input:

yhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyyhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyyhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyhyyhyhhyyhhyhyyhyhhyhyyhhyyhyhhyyhhyhyyhhyyh...

output:

269769773

result:

ok 1 number(s): "269769773"

Test #29:

score: 0
Accepted
time: 313ms
memory: 176004kb

input:

baababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaababbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaabbaababbaabbabaababbabaabbaababbabaababbaabbabaababbabaabbaababbaabbabaabbaababbabaababbaabbabaababbabaabbaababbabaababbaabbabaabbaababbaabba...

output:

287077563

result:

ok 1 number(s): "287077563"

Extra Test:

score: 0
Extra Test Passed