QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#449976#5037. 回文waretle20 7631ms114468kbC++1415.0kb2024-06-21 21:30:182024-06-21 21:30:20

Judging History

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

  • [2024-06-21 21:30:20]
  • 评测
  • 测评结果:20
  • 用时:7631ms
  • 内存:114468kb
  • [2024-06-21 21:30:18]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N=2e5+5,mod1=998244353,mod2=1e9+7;
int qpow(int a,int b,int m)
{
    int c=1;
    for(;b;b>>=1,a=1ll*a*a%m)
        if(b&1)c=1ll*c*a%m;
    return c;
}
struct hash_val
{
    int v1;
    hash_val(){v1=0;}
    hash_val(int x){v1=x;}
//    hash_val(int x,int y){v1=x,v2=y;}
    void operator+=(const hash_val&a){v1+=a.v1,v1>=mod1&&(v1-=mod1);}
    void operator-=(const hash_val&a){v1-=a.v1,v1<0&&(v1+=mod1);}
    void operator*=(const hash_val&a){v1=1ll*v1*a.v1%mod1;}
    hash_val operator+(const hash_val&a)const{hash_val c=*this;c+=a;return c;}
    hash_val operator-(const hash_val&a)const{hash_val c=*this;c-=a;return c;}
    hash_val operator*(const hash_val&a)const{hash_val c=*this;c*=a;return c;}
    bool operator==(const hash_val&a)const{return v1==a.v1;}
    bool operator!=(const hash_val&a)const{return v1!=a.v1;}
}pw[N],ipw[N];
const hash_val base={114514},ibase={137043501};
struct String
{
    hash_val vl;
    int len;
};
vector<hash_val>coef[N];
String operator+(const String&a,const String&b){return {a.vl+b.vl*pw[a.len],a.len+b.len};};
String operator*(const String&a,int b){return {a.vl*coef[a.len][b],a.len*b};}
bool operator==(const String&a,const String&b){return a.vl==b.vl&&a.len==b.len;}
bool operator!=(const String&a,const String&b){return a.vl!=b.vl||a.len!=b.len;}
struct ___
{
    ___()
    {
        pw[0]=ipw[0]=hash_val(1);
        for(int i=1;i<N;++i)pw[i]=pw[i-1]*base,ipw[i]=ipw[i-1]*ibase;
        for(int i=1;i<N;++i)
        {
            coef[i].resize(N/i+1);
            for(int j=1;j*i<N;++j)
                coef[i][j]=coef[i][j-1]+pw[(j-1)*i];
        }
    }
}____;
namespace DS
{
hash_val pre[N],bpre[N],suf[N],bsuf[N];
int n,bl[N],L[N],R[N];
char a[N];
const int S=400;
void init(int N,char*s)
{
    n=N;
    for(int i=1;i<=n;++i)a[i]=s[i];
    for(int i=1;i<=n;++i)bl[i]=(i+S-1)/S;
    for(int i=1;i<=bl[n];++i)L[i]=i*S-S+1,R[i]=min(i*S,n);
    for(int i=1;i<=n;++i)
        if(i==L[bl[i]])pre[i]=hash_val(s[i]);
        else pre[i]=pre[i-1]+hash_val(s[i])*pw[i-L[bl[i]]];
    for(int i=n;i>=1;--i)
        if(i==R[bl[i]])suf[i]=hash_val(s[i]);
        else suf[i]=suf[i+1]+hash_val(s[i])*pw[R[bl[i]]-i];
    for(int i=1;i<=bl[n];++i)
        bpre[i]=bpre[i-1]+pre[R[i]]*pw[R[i-1]];
    for(int i=bl[n];i>=1;--i)
        bsuf[i]=bsuf[i+1]+suf[L[i]]*pw[n-R[i]];
}
void modify(int x,char c)
{
    hash_val dlt=hash_val(c)-hash_val(a[x]);a[x]=c;
    for(int i=x;i<=R[bl[x]];++i)
        pre[i]+=dlt*pw[x-L[bl[x]]];
    for(int i=x;i>=L[bl[x]];--i)
        suf[i]+=dlt*pw[R[bl[x]]-x];
    for(int i=bl[x];i<=n;++i)
        bpre[i]+=dlt*pw[x-1];
    for(int i=bl[x];i>=1;--i)
        bsuf[i]+=dlt*pw[n-x];
}
hash_val getpre(int l,int r)
{
    if(l<1||r>n)return hash_val(-1);
    if(l==r+1)return hash_val(0);
    auto calcblock=[&](int l,int r)
    {
        int x=bl[l];//assert(x==bl[r]);
        return (pre[r]-pre[l!=L[x]?l-1:0])*ipw[l-L[x]];
    };
    hash_val ret=0;
    if(bl[l]<bl[r])
    {
        ret+=calcblock(l,R[bl[l]]);
        if(bl[l]+1<bl[r])ret+=(bpre[bl[r]-1]-bpre[bl[l]])*ipw[l-1];
        ret+=pre[r]*pw[L[bl[r]]-l];
    }
    else ret=calcblock(l,r);
    return ret;
}
hash_val getsuf(int l,int r)
{
    if(l<1||r>n)return hash_val(-1);
    if(l==r+1)return hash_val(0);
//    if(l>r)assert(0);
    // cerr<<l<<' '<<r<<'\n';
    auto calcblock=[&](int l,int r)
    {
        int x=bl[l];//assert(x==bl[r]);
        return (suf[l]-suf[r!=R[x]?r+1:0])*ipw[R[x]-r];
    };
    hash_val ret=hash_val(0);
    if(bl[l]<bl[r])
    {
        ret+=calcblock(L[bl[r]],r);
        if(bl[l]+1<bl[r])ret+=(bsuf[bl[l]+1]-bsuf[bl[r]])*ipw[n-r];
        ret+=suf[l]*pw[r-R[bl[l]]];
    }
    else ret=calcblock(l,r);
    return ret;
}
}//namespace DS
namespace DS2
{
hash_val pre[N],bpre[N],suf[N],bsuf[N];
int n,bl[N],L[N],R[N];
char a[N];
const int S=400;
void init(int N,char*s)
{
    n=N;
    for(int i=1;i<=n;++i)a[i]=s[i];
    for(int i=1;i<=n;++i)bl[i]=(i+S-1)/S;
    for(int i=1;i<=bl[n];++i)L[i]=i*S-S+1,R[i]=min(i*S,n);
    for(int i=1;i<=n;++i)
        if(i==L[bl[i]])pre[i]=hash_val(s[i]);
        else pre[i]=pre[i-1]+hash_val(s[i])*pw[i-L[bl[i]]];
    for(int i=n;i>=1;--i)
        if(i==R[bl[i]])suf[i]=hash_val(s[i]);
        else suf[i]=suf[i+1]+hash_val(s[i])*pw[R[bl[i]]-i];
    for(int i=1;i<=bl[n];++i)
        bpre[i]=bpre[i-1]+pre[R[i]]*pw[R[i-1]];
    for(int i=bl[n];i>=1;--i)
        bsuf[i]=bsuf[i+1]+suf[L[i]]*pw[n-R[i]];
}
void modify(int x,char c)
{
    hash_val dlt=hash_val(c)-hash_val(a[x]);a[x]=c;
    for(int i=x;i<=R[bl[x]];++i)
        pre[i]+=dlt*pw[x-L[bl[x]]];
    for(int i=x;i>=L[bl[x]];--i)
        suf[i]+=dlt*pw[R[bl[x]]-x];
    for(int i=bl[x];i<=n;++i)
        bpre[i]+=dlt*pw[x-1];
    for(int i=bl[x];i>=1;--i)
        bsuf[i]+=dlt*pw[n-x];
}
hash_val Getpre(int l,int r)
{
    if(l<1||r>n)return hash_val(-1);
    if(l==r+1)return hash_val(0);
    auto calcblock=[&](int l,int r)
    {
        int x=bl[l];//assert(x==bl[r]);
        return (pre[r]-pre[l!=L[x]?l-1:0])*ipw[l-L[x]];
    };
    hash_val ret=hash_val(0);
    if(bl[l]<bl[r])
    {
        ret+=calcblock(l,R[bl[l]]);
        if(bl[l]+1<bl[r])ret+=(bpre[bl[r]-1]-bpre[bl[l]])*ipw[l-1];
        ret+=pre[r]*pw[L[bl[r]]-l];
    }
    else ret=calcblock(l,r);
    return ret;
}
hash_val Getsuf(int l,int r)
{
    if(l<1||r>n)return hash_val(-1);
    if(l==r+1)return hash_val(0);
    auto calcblock=[&](int l,int r)
    {
        int x=bl[l];//assert(x==bl[r]);
        return (suf[l]-suf[r!=R[x]?r+1:0])*ipw[R[x]-r];
    };
    hash_val ret=hash_val(0);
    if(bl[l]<bl[r])
    {
        ret+=calcblock(L[bl[r]],r);
        if(bl[l]+1<bl[r])ret+=(bsuf[bl[l]+1]-bsuf[bl[r]])*ipw[n-r];
        ret+=suf[l]*pw[r-R[bl[l]]];
    }
    else ret=calcblock(l,r);
    return ret;
}
}//namespace DS2
using DS::getpre;
using DS::getsuf;
using DS2::Getpre;
using DS2::Getsuf;
char s[N];
int n;
struct info{int l,r,d;};
ostream&operator<<(ostream&a,info b){return a<<b.l<<' '<<b.r<<' '<<b.d;}
struct node{vector<info>pre,suf;int l,r;}tr[N*4];
ostream&operator<<(ostream&a,node b)
{
    a<<b.l<<' '<<b.r<<'\n';
    for(info i:b.pre)cerr<<i.l<<' '<<i.r<<' '<<i.d<<'\n';
    cerr<<'\n';
    for(info i:b.suf)cerr<<i.l<<' '<<i.r<<' '<<i.d<<'\n';
    return a;
}
String getprestr(int l,int r){return {getpre(l,r),r-l+1};}
String getsufstr(int l,int r){return {getsuf(l,r),r-l+1};}
String Getprestr(int l,int r){return {Getpre(l,r),r-l+1};}
String Getsufstr(int l,int r){return {Getsuf(l,r),r-l+1};}
void maintain(vector<info>&v,int lim)
{
//    for(int i=1;i<v.size();++i)assert(v[i].l>=v[i-1].r);
    while(v.back().l>lim)v.pop_back();
    if(v.back().r>lim)v.back().r=(lim-v.back().l)/v.back().d*v.back().d+v.back().l;
    vector<pair<int,int>>t;
    for(int i=0;i<v.size();++i)
    {
        if(i)t.emplace_back(v[i].l-v[i-1].r,1);
        else t.emplace_back(v[i].l,1);
        if(v[i].l<v[i].r)t.emplace_back(v[i].d,(v[i].r-v[i].l)/v[i].d);
    }
    t.erase(partition(t.begin(),t.end(),[&](auto x){return x.first>0;}),t.end());
    v.clear();
    int sum=0;
    for(int l=0,r;l<t.size();l=r+1)
    {
        int num=t[l].second;
        r=l;while(r+1<t.size()&&t[l].first==t[r+1].first)num+=t[++r].second;
        v.push_back({sum+t[l].first,sum+num*t[l].first,t[l].first}),sum+=num*t[l].first;
    }
    assert(v.size()<=20);
}
vector<info>mergepre(const node&a,const node&b)
{
    assert(a.r==b.l-1);
    vector<info>ret=a.pre;
    int lena=a.r-a.l+1,lenb=b.r-b.l+1;
    auto work=[&](int x)
    {
        if(x>lena+lenb)return;
        int m=x+1>>1;
        if(getpre(a.l,a.l+m-1)==getsuf(a.l+x-m,a.l+x-1))
            ret.push_back({x,x,0});
    };
    for(int I=a.suf.size()-1;I>=0;--I)
    {
        info i=a.suf[I];
		int tmp=(i.r-i.l)/i.d;
        if(i.l==i.r)work(2*lena-i.l);
        else
        {
            String B=getsufstr(a.r-i.l-i.d+1,a.r-i.l);
            String C=getsufstr(a.l,a.r-i.r);
            int num=0;
            for(int i=__lg(min(tmp,lenb/B.len)+1);~i;--i)
            {
                int nlen=(num|1<<i)*B.len;
                if(nlen<=lenb&&B*(num|1<<i)==getprestr(b.l,b.l+nlen-1))
                    num|=1<<i;
            }
            if(C.len<B.len&&getsufstr(a.r-i.l-C.len+1,a.r-i.l)==C)
            {
                if(num*B.len+C.len<=lenb&&getprestr(b.l+num*B.len,b.l+num*B.len+C.len-1)==C)
                    ++num;
                if(num)
                    ret.push_back({lena*2-i.r,lena*2-max(i.l,i.r-(num-1)*B.len),i.d});
            }
            else
            {
                if((i.r-i.l)/i.d>=num)
                    work(lena*2-i.r+num*B.len);
            }
        }
    }
    if(lena<=lenb)work(lena*2);
    for(info i:b.pre)
    {
		int tmp=(i.r-i.l)/i.d;
        if(i.l==i.r)work(lena*2+i.l);
        else
        {
            String B=getprestr(b.l+i.l,b.l+i.l+i.d-1);
            int num=0;
            for(int i=__lg(min(tmp,lena/B.len)+1);~i;--i)
            {
                int nlen=(num|1<<i)*B.len;
                if(nlen<=lena&&B*(num|1<<i)==getsufstr(a.r-nlen+1,a.r))
                    num|=1<<i;
            }
            if(num>i.r-i.l)continue;
            String C=getsufstr(a.l,a.r-num*B.len);
            if(C==getprestr(b.l+i.l,b.l+i.l+C.len-1))
            {
                if(b.l+i.r+C.len-1<=b.r&&C!=getprestr(b.l+i.r,b.l+i.r+C.len-1))
                    ++num;
                if((i.r-i.l)/i.d>=num)
                    ret.push_back({lena*2+i.l,lena*2+i.r-num*i.d,i.d});
            }
            else
            {
                if((i.r-i.l)/i.d>=num)
                    work(i.r-num*i.d+lena*2);
            }
        }
    }
    // for(info i:ret)cerr<<i.l<<' '<<i.r<<' '<<i.d<<'\n';
    // cerr<<ret.size()<<'\n';
    maintain(ret,lena+lenb);
    return ret;
}
vector<info>mergesuf(const node&a,const node&b)
{
    assert(a.r==b.l-1);
    vector<info>ret=a.pre;
    int lena=a.r-a.l+1,lenb=b.r-b.l+1;
    auto work=[&](int x)
    {
        if(x>lena+lenb)return;
        int m=x+1>>1;
        if(Getpre(a.l,a.l+m-1)==Getsuf(a.l+x-m,a.l+x-1))
            ret.push_back({x,x,0});
    };
    for(int I=a.suf.size()-1;I>=0;--I)
    {
        info i=a.suf[I];
		int tmp=(i.r-i.l)/i.d;
        if(i.l==i.r)work(2*lena-i.l);
        else
        {
            String B=Getsufstr(a.r-i.l-i.d+1,a.r-i.l);
            String C=Getsufstr(a.l,a.r-i.r);
            int num=0;
            for(int i=__lg(min(tmp,lenb/B.len)+1);~i;--i)
            {
                int nlen=(num|1<<i)*B.len;
                if(nlen<=lenb&&B*(num|1<<i)==Getprestr(b.l,b.l+nlen-1))
                    num|=1<<i;
            }
            if(C.len<B.len&&Getsufstr(a.r-i.l-C.len+1,a.r-i.l)==C)
            {
                if(num*B.len+C.len<=lenb&&Getprestr(b.l+num*B.len,b.l+num*B.len+C.len-1)==C)
                    ++num;
                if(num)
                    ret.push_back({lena*2-i.r,lena*2-max(i.l,i.r-(num-1)*B.len),i.d});
            }
            else
            {
                if((i.r-i.l)/i.d>=num)
                    work(lena*2-i.r+num*B.len);
            }
        }
    }
    if(lena<=lenb)work(lena*2);
    for(info i:b.pre)
    {
    	int tmp=(i.r-i.l)/i.d;
        if(i.l==i.r)work(lena*2+i.l);
        else
        {
            String B=Getprestr(b.l+i.l,b.l+i.l+i.d-1);
            int num=0;
            for(int i=__lg(min(tmp,lena/B.len)+1);~i;--i)
            {
                int nlen=(num|1<<i)*B.len;
                if(nlen<=lena&&B*(num|1<<i)==Getsufstr(a.r-nlen+1,a.r))
                    num|=1<<i;
            }
            if(num>i.r-i.l)continue;
            String C=Getsufstr(a.l,a.r-num*B.len);
            if(C==Getprestr(b.l+i.l,b.l+i.l+C.len-1))
            {
                if(b.l+i.r+C.len-1<=b.r&&C!=Getprestr(b.l+i.r,b.l+i.r+C.len-1))
                    ++num;
                if((i.r-i.l)/i.d>=num)
                    ret.push_back({lena*2+i.l,lena*2+i.r-num*i.d,i.d});
            }
            else
            {
                if((i.r-i.l)/i.d>=num)
                    work(i.r-num*i.d+2*lena);
            }
        }
    }
    maintain(ret,lena+lenb);
    return ret;
}
node operator+(node a,node b)
{
//    cerr<<a.l<<' '<<b.l<<'\n';
if(a.l==1&&b.r==7)
    n=n;
    node ret;ret.l=a.l,ret.r=b.r;
    ret.pre=mergepre(a,b);
    a.l=n-a.l+1,a.r=n-a.r+1,b.l=n-b.l+1,b.r=n-b.r+1;
    swap(a.l,a.r),swap(b.l,b.r);
    swap(a.pre,a.suf),swap(b.pre,b.suf);
    ret.suf=mergesuf(b,a);
    return ret;
}
void build(int k,int l,int r)
{
    tr[k].l=l,tr[k].r=r;
    if(l==r){tr[k].pre=tr[k].suf={{1,1,0}};return;}
    int mid=l+r>>1;
    build(k<<1,l,mid),build(k<<1|1,mid+1,r);
    tr[k]=tr[k<<1]+tr[k<<1|1];
//     cerr<<k<<' '<<l<<' '<<r<<"!\n";
//     for(info i:tr[k].pre)cerr<<i.l<<' '<<i.r<<' '<<i.d<<'\n';
//     cerr<<'\n';
//     for(info i:tr[k].suf)cerr<<i.l<<' '<<i.r<<' '<<i.d<<'\n';
//     cerr<<'\n';
}
void upd(int k,int l,int r,int x)
{
    if(l==r)return;
    int mid=l+r>>1;
    if(mid>=x)upd(k<<1,l,mid,x);
    else upd(k<<1|1,mid+1,r,x);
//    cerr<<k<<' '<<l<<' '<<r<<"!\n";
//     for(info i:tr[k].pre)cerr<<i.l<<' '<<i.r<<' '<<i.d<<'\n';
//     cerr<<'\n';
//     for(info i:tr[k].suf)cerr<<i.l<<' '<<i.r<<' '<<i.d<<'\n';
//     cerr<<'\n';
    tr[k]=tr[k<<1]+tr[k<<1|1];
}
node query(int k,int l,int r,int x,int y)
{
    if(l>=x&&r<=y)return tr[k];
    int mid=l+r>>1;
    if(mid>=y)return query(k<<1,l,mid,x,y);
    if(mid<x)return query(k<<1|1,mid+1,r,x,y);
    return query(k<<1,l,mid,x,y)+query(k<<1|1,mid+1,r,x,y);
}
int getans(int l,int r)
{
    node res=query(1,1,n,l,r);
    maintain(res.suf,r-l+1);
    int ans=0,lim=r-l+1;
    for(auto i:res.suf)
        if(i.r<=lim)ans+=(i.r-i.l)/i.d+1;
        else{ans+=(lim-i.l)/i.d+1;break;}
    return ans;
}
int main()
{
    scanf("%s",s+1),n=strlen(s+1);
    DS::init(n,s);
    reverse(s+1,s+n+1);
    DS2::init(n,s);
    build(1,1,n);
    int Q;scanf("%d",&Q);
    int lans=0;
//    cerr<<query(1,1,n,1,5)<<'\n';
//    cerr<<query(1,1,n,6,7)<<'\n';
//    cerr<<query(1,1,n,1,7)<<'\n';
//    cerr<<query(1,1,n,11,16)<<'\n';
//    cerr<<getans(11,16)<<'\n';
//    cerr<<query(1,1,n,11,16)<<'\n';
//    cerr<<query(1,1,n,10,16)<<'\n';
    for(int i=1;i<=Q;++i)
    {
        int o;scanf("%d",&o);
        if(o==1)
        {
            int x;char c;scanf("%d %c",&x,&c);x^=lans;
//            cerr<<x<<' '<<c<<"!\n";
            assert(1<=x&&x<=n);
            DS::modify(x,c),DS2::modify(n-x+1,c);
            upd(1,1,n,x);
        }
        else
        {
//        	for(int i=1;i<=n;++i)for(int j=i;j<=n;++j)
//        		cerr<<i<<' '<<j<<' '<<DS::getsuf(i,j).v1<<'\n';
            int l,r;scanf("%d%d",&l,&r);l^=lans,r^=lans;
//            cerr<<l<<' '<<r<<'\n';
            assert(1<=l&&l<=r&&r<=n);
            printf("%d\n",lans=getans(l,r));
        }
    }
}

詳細信息

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 66ms
memory: 80016kb

input:

aabbbabbbaaaaaaabbabbbaaaabaaaabbaabbaabbaaababbbabbbbabbbbaaaabbbabbbbbaaabbbabbaaaaabbbbbaaababbabbaaaaabaabbbbaaababaaabbaabbabbbabbbbaaaaabbbbbbbabbbaabbbabbabbbababbabbbbaaaaabbaababbbbaabbaaaaaabaaabbbaaababbbbaabaaaaababababbbbbbaaaabbbbaaababaaabbaabbbbbaaaabbaaaabaaaaaababbababaaaabaaababaa...

output:

2
3
5
3
3
3
2
3
4
2
4
2
4
2
3
3
3
2
2
2
2
2
2
3
4
2
2
3
2
2
4
3
3
2
3
3
4
3
3
4
4
2
3
4
2
2
4
2
4
3
2
2
2
3
3
3
4
4
3
3
2
3
3
2
3
3
4
2
2
4
2
3
2
3
3
2
3
2
2
3
2
2
3
6
2
2
3
7
4
3
2
2
2
2
3
4
4
4
4
2
2
3
2
4
2
2
2
3
3
2
2
2
2
3
3
4
3
2
3
3
2
2
4
5
4
2
2
5
3
3
3
3
2
4
2
3
2
3
3
3
2
4
4
5
2
2
3
5
3
3
...

result:

ok 2509 tokens

Test #2:

score: 0
Accepted
time: 68ms
memory: 80040kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

188
1078
673
914
360
4255
2205
3628
77
3608
230
494
128
848
801
1335
4079
3059
636
2882
3524
45
1174
506
3570
4172
1289
595
3829
1532
179
1274
2574
1098
2817
226
2580
887
989
1829
3656
181
2056
3315
786
117
2519
2742
3787
1080
3138
686
1605
239
1533
2658
2096
753
3400
219
1815
117
1645
52
1671
121
2...

result:

ok 2519 tokens

Test #3:

score: 0
Accepted
time: 72ms
memory: 80024kb

input:

bbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbbbbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbbbbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbbbbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbbabbba...

output:

12
8
12
24
30
18
11
8
32
18
10
32
26
11
11
15
18
6
18
19
13
21
10
13
20
16
10
10
10
9
16
11
32
14
24
20
29
15
10
17
10
8
8
22
31
9
9
18
25
10
14
16
22
24
15
15
11
13
33
7
13
21
7
19
12
12
17
7
23
15
2
10
16
15
9
14
6
18
10
8
18
20
21
5
11
18
3
17
13
17
8
11
17
7
6
7
11
10
9
20
9
28
19
10
14
11
24
8
...

result:

ok 5000 tokens

Test #4:

score: 0
Accepted
time: 44ms
memory: 79980kb

input:

mkmamkmlmkmamkmnmkmamkmlmkmamkmamkmamkmlmkmamkmnmkmamkmlmkmamkmumkmamkmlmkmamkmnmkmamkmlmkmamkmamkmamkmlmkmamkmnmkmamkmlmkmamkmkmkmamkmlmkmamkmnmkmamkmlmkmamkmamkmamkmlmkmamkmnmkmamkmlmkmamkmumkmamkmlmkmamkmnmkmamkmlmkmamkmamkmamkmlmkmamkmnmkmamkmlmkmamkmpmkmamkmlmkmamkmnmkmamkmlmkmamkmamkmamkmlmkma...

output:

5
8
5
6
5
6
7
7
5
8
5
5
6
5
9
6
5
6
7
8
5
5
8
6
4
5
8
5
8
4
6
4
5
6
5
1
5
7
4
5
7
3
5
8
9
6
4
5
5
4
7
7
5
7
8
7
6
5
7
1
5
5
6
6
6
6
7
6
6
4
5
5
6
3
8
7
5
6
6
7
4
4
7
7
6
6
7
8
6
7
7
4
7
6
8
3
5
7
3
6
7
6
4
7
6
4
5
6
6
4
6
7
4
5
5
5
4
4
5
6
3
4
4
5
4
7
5
4
9
6
5
5
3
4
5
8
4
5
5
6
4
6
6
6
4
9
7
4
6
6
...

result:

ok 5000 tokens

Test #5:

score: 0
Accepted
time: 75ms
memory: 80116kb

input:

babababababababababababababababababababababababababababababababbbabababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababbbabababababababababababababababababababababababababababababababbbabababababababababababababababababababababa...

output:

58
13
6
23
52
35
39
46
17
43
37
33
31
8
51
12
9
52
57
14
28
17
31
21
59
50
55
50
18
10
54
7
44
11
10
3
12
19
9
8
5
7
22
4
38
15
10
14
26
11
21
18
33
12
3
8
23
34
41
18
7
18
26
7
12
29
34
6
4
15
16
20
15
8
50
23
7
51
18
4
11
7
20
14
33
19
12
9
10
6
8
21
28
22
21
18
12
18
4
15
17
13
8
16
7
14
10
4
5
3...

result:

ok 2443 tokens

Test #6:

score: 0
Accepted
time: 68ms
memory: 79976kb

input:

aaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaaaaaaaaaabaabaaaaaaaa...

output:

43
25
18
13
12
27
16
18
22
24
13
20
34
18
5
27
26
27
8
10
6
9
9
14
22
15
34
25
19
24
19
18
13
7
21
14
2
33
7
46
16
18
19
12
25
8
7
14
22
2
2
12
19
3
20
15
18
10
8
8
8
12
5
12
18
22
7
15
16
36
21
11
11
14
8
13
12
2
5
40
14
15
2
5
11
4
12
16
11
9
9
6
6
18
16
11
15
18
13
15
8
24
19
9
5
15
18
8
13
5
31
...

result:

ok 2498 tokens

Test #7:

score: 0
Accepted
time: 50ms
memory: 80172kb

input:

baabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabcaaaaaaaacbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabbaabba...

output:

67
7
4
13
81
3
8
92
28
86
94
92
71
23
73
26
24
13
71
88
98
42
70
45
82
63
5
80
57
49
48
77
88
5
98
96
65
52
11
24
52
51
76
90
9
10
58
43
36
48
82
73
10
14
90
54
74
12
32
36
71
46
8
46
20
38
22
68
54
73
66
32
95
63
52
7
40
97
27
13
42
59
41
14
9
44
53
52
92
30
36
27
86
90
59
95
12
36
42
16
24
58
23
5...

result:

ok 5000 tokens

Test #8:

score: 0
Accepted
time: 93ms
memory: 80028kb

input:

caaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaaccabccbaccaaccaaccaaccaaccaaccaac...

output:

10
10
11
11
11
10
10
10
8
10
11
11
9
9
10
10
10
11
10
11
9
10
10
11
11
11
10
11
11
11
11
11
11
11
11
10
10
10
10
11
11
11
10
11
10
10
10
11
10
10
10
10
10
11
11
11
11
10
11
11
11
10
11
11
11
10
10
7
11
11
10
11
10
10
11
10
11
10
10
7
11
11
10
10
11
11
10
10
2
11
11
11
5
11
11
11
11
11
10
10
10
11
11...

result:

ok 1667 tokens

Test #9:

score: 0
Accepted
time: 91ms
memory: 79928kb

input:

cabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbbaccbaccabccabbbbbb...

output:

38
38
38
37
38
38
38
9
37
38
8
38
37
38
38
38
38
38
38
37
27
38
38
38
38
38
38
30
38
38
38
38
38
38
38
38
24
38
38
38
38
38
38
38
38
38
37
38
5
38
32
25
38
38
38
38
38
38
38
38
38
38
38
37
38
37
38
31
38
38
38
38
38
38
12
38
38
37
38
38
38
38
37
38
38
38
23
38
38
38
38
24
38
38
38
38
38
35
38
38
38
...

result:

ok 1667 tokens

Test #10:

score: 0
Accepted
time: 83ms
memory: 79920kb

input:

baaabbbaaabbbbaaababbababbabbbbaaaababaababbbbababababbbaabbbaababaaaababbbaaabaaababbababaaabbabbbaaabbabbbabaabaaaababbbbabbbbbaabbabbaaaabaaabababbbaababbbaaaaaababbabaaabaaaabbbabbbaababbbbbbbbaabbbaabbabaabababbaabaabaabbbbbaaababbbbabbbababababaabbababaabbabbbbbbaaaaaaabaabbabbabaabbbbbaaaaaba...

output:

3
3
2
3

result:

ok 4 tokens

Test #11:

score: 0
Accepted
time: 41ms
memory: 79944kb

input:

abbaaabaabbbaabbabbbbbbaabbbbabbaabababaabbabbabaaabbabbbaaaabbabbaabbbabbbabbababaaaabbabbaabababbbaaababaababbabbaaabbbaabaaaaaabbbabbababaabbbbbabbbaaaaaaabbaaaabaaababbababaabaaabbbaaabbaabbabbabbbababbabbbbbbbbaabbabbbabbbbbbbababaabbbaabaabaabaaabababbaabbbbaaabbbbabbaabbbabbbababaababbabbabba...

output:

3
4
2
2
4
2
2
4
3
5
2
2
3
4
3
2
3
4
6
2
2
2
2
2
5
3
4
3
3
2
2
2
2
5
2
3
2
3
2
3
2
3
2
4
2
2
3
2
2
3
5
2
2
7
3
2
3
2
3
3
2
2
3
4
3
2
4
2
2
2
3
3
3
3
3
2
3
3
3
5
2
4
2
3
3
3
3
3
3
2
4
4
3
4
2
2
3
3
6
2
5
4
2
2
4
2
5
3
3
2
5
4
3
3
3
3
4
3
2
3
2
4
2
3
6
3
3
2
3
3
2
3
3
5
2
3
4
3
5
3
3
3
3
4
2
3
3
2
3
2
...

result:

ok 4997 tokens

Test #12:

score: 0
Accepted
time: 46ms
memory: 79808kb

input:

lxxhwqorbxrdzedxlvymggyicczuafgyovixrzmptqfmjyjfpamcsehmfazbvfwdgeftgbtyurnnykwjhzfqqsyiyzkpwlmspjsxdkjtpgzbrvwwcjqejmuillhgtbhwtwmvhacfphrcgwoaihjzkuccmwuidivmpjcezbjywhbqtdgrhlrskcwmecflzpjbuutlocivcfvbcdvlnfchtvvcpoubnjwfwvzvpyvhkvxdmleyvucrondntpaonjybzarkgjnkuuvipkqgvwzzzopwyfnmodnmdziueescfttr...

output:

1
1
1
1
1
2
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 2493 tokens

Test #13:

score: 0
Accepted
time: 72ms
memory: 80032kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

849
1135
1444
1346
1445
536
3077
2631
1447
672
2214
2149
2090
4054
846
559
22
92
4224
161
2280
572
2347
2599
778
4093
750
3647
2142
642
474
1395
776
645
46
4141
2272
771
1564
207
4284
2896
3097
2829
306
1383
394
1776
1284
3933
102
510
1101
3639
1336
1292
2803
1159
601
1464
2585
673
281
1340
272
3310...

result:

ok 2478 tokens

Test #14:

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

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
5000
...

result:

ok 4999 tokens

Subtask #2:

score: 10
Accepted

Test #15:

score: 10
Accepted
time: 4119ms
memory: 109680kb

input:

aabababbabbbbbbabbababaaaabababbabbbbbbabbababaaaabababbabbbbbbabbababaaaabababbabbbbbbabbababaabbbaaabbaabbbbaabbaaabbbaabababbabbbbbbabbababaaaabababbabbbbbbabbababaaaabababbabbbbbbabbababaaaabababbabbbbbbabbababaabbaaabaaaaaabaaabbaabababbabbbbbbabbababaaaabababbabbbbbbabbababaaaabababbabbbbbbabb...

output:

41
43
154
118
55
165
48
163
119
207
147
145
33
67
114
124
154
9
104
307
102
73
39
364
79
177
53
39
88
264
77
114
79
195
150
153
157
46
129
136
147
25
309
11
12
258
259
133
355
50
116
336
13
127
18
34
122
161
38
99
290
92
355
166
59
152
41
182
103
282
166
23
86
173
32
122
60
127
287
20
83
214
119
144...

result:

ok 200000 tokens

Test #16:

score: 0
Accepted
time: 4833ms
memory: 109476kb

input:

beebbeebbeebbeebbeebddbeebbeebbeebbeebbeebbeebbeebbeebbeebbeebddbeebbeebbeebbeebbeebbeebbeebbeebbeebbeebddbeebbeebbeebbeebbeebbeebbeebbeebbeebbeebddbeebbeebbeebbeebbeebccbeebbeebbeebbeebbeebddbeebbeebbeebbeebbeebbeebbeebbeebbeebbeebddbeebbeebbeebbeebbeebbeebbeebbeebbeebbeebddbeebbeebbeebbeebbeebbeeb...

output:

38
55
18
35
62
44
48
20
70
35
36
42
40
11
14
13
67
54
61
70
51
27
62
18
39
52
53
53
34
57
53
46
28
22
15
64
32
44
11
11
57
35
21
45
32
39
42
27
31
51
28
31
18
12
25
41
55
37
42
17
38
33
21
29
54
15
43
24
17
42
63
19
32
49
17
21
50
62
52
56
49
56
18
24
17
22
26
18
60
31
24
59
58
69
18
16
38
39
54
48
...

result:

ok 200000 tokens

Test #17:

score: 0
Accepted
time: 3897ms
memory: 106884kb

input:

cgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagcaidiaaidiacgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccgaaaabgceiddiecgbaaaagccg...

output:

17
15
19
21
17
18
21
12
12
15
18
20
14
14
16
20
15
19
11
17
10
20
16
16
16
19
12
17
16
15
18
12
24
20
12
19
9
17
13
21
28
10
13
17
10
14
13
24
17
17
19
24
11
18
16
14
13
13
17
13
22
21
20
14
7
11
18
15
18
12
12
12
19
14
15
16
19
20
16
23
19
16
18
13
24
22
17
13
15
21
21
22
13
21
19
20
9
20
14
14
15
...

result:

ok 200000 tokens

Test #18:

score: 0
Accepted
time: 2511ms
memory: 107560kb

input:

rprxrprmrprxrprkrprxrprmrprxrprhrprxrprmrprxrprkrprxrprmrprxrprwrprxrprmrprxrprkrprxrprmrprxrprhrprxrprmrprxrprkrprxrprmrprxrprvrprxrprmrprxrprkrprxrprmrprxrprhrprxrprmrprxrprkrprxrprmrprxrprwrprxrprmrprxrprkrprxrprmrprxrprhrprxrprmrprxrprkrprxrprmrprxrprbrprxrprmrprxrprkrprxrprmrprxrprhrprxrprmrprx...

output:

7
8
5
9
9
6
8
8
7
7
8
12
4
9
8
8
9
11
10
9
8
10
5
6
5
10
11
6
6
10
7
3
12
9
6
12
10
7
13
9
10
8
7
7
9
9
13
9
11
11
7
11
5
5
3
9
10
7
10
12
11
12
9
9
11
12
8
4
6
8
12
10
5
4
7
10
4
7
6
4
8
6
5
9
7
9
12
10
8
11
7
11
8
7
8
6
8
9
8
10
9
5
8
5
11
8
8
7
5
3
11
8
10
6
10
10
8
9
4
5
9
8
7
10
7
4
7
10
11
9
9...

result:

ok 200000 tokens

Test #19:

score: 0
Accepted
time: 4431ms
memory: 114248kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998...

result:

ok 200000 tokens

Test #20:

score: 0
Accepted
time: 3862ms
memory: 107620kb

input:

susjsusosusjsusgsusjsusosusjsusmsusjsusosusjsusgsusjsusosusjsusnsusjsusosusjsusgsusjsusosusjsusmsusjsusosusjsusgsusjsusosusjsusysusjsusosusjsusgsusjsusosusjsusmsusjsusosusjsusgsusjsusosusjsusnsusjsusosusjsusgsusjsusosusjsusmsusjsusosusjsusgsusjsusosusjsusisusjsusosusjsusgsusjsusosusjsusmsusjsusosusj...

output:

11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
11
...

result:

ok 200000 tokens

Subtask #3:

score: 0
Time Limit Exceeded

Test #21:

score: 0
Time Limit Exceeded

input:

abbaaaabbabaaaaaabaabbaabbababbaaabbabbbabaabaabaaaaabaabbbbabbabbabbbababbbababababbbbabaabbaaababbbbbababbbbaabbbaaabaababababaabbbbbbaababaabbaaabaabbaaababbabbabbbbaaaaabaaabbbabbbbbbabbbabbabaabbbbbbbaaaabbaaaababbbaaaaaaababaabbbbaaabaaabbaabbbbbbababbaabbaaabbabbbbbabaababbaabaaaabbbbabababba...

output:


result:


Subtask #4:

score: 0
Time Limit Exceeded

Test #27:

score: 0
Time Limit Exceeded

input:

babbaaabbbbbbbabbbababaabbbbbababababbaabaabbbbbbabbbbbbbbbbababbbbabbaabbbaabaabbabbbaabbabbbabbababaababbbabbbbaabbabbabbaaaabbbaaabbbbaabbaaaaaaabbbabbbaaabaababaaabaaaabaaaababaaaaababaaaabaabbaaaabbbabbaabaabbbabbbbbaaabaababbbaaaaabbbbaaabbbbaabbabbbbabbbabbaaaaabaabaaaabbbabbbbbaabbbbabbbbaab...

output:

4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
...

result:


Subtask #5:

score: 0
Time Limit Exceeded

Dependency #1:

100%
Accepted

Test #35:

score: 30
Accepted
time: 7631ms
memory: 114348kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

199105
199317
198628
198977
198643
198338
198952
198567
198980
198350
199045
199831
199124
199126
199123
199367
198992
198131
198623
199391
199376
199431
198418
198674
199222
199031
198833
198400
199208
198925
198477
198700
198952
199129
199580
199549
198972
199285
199185
198739
199281
199208
198920...

result:

ok 24945 tokens

Test #36:

score: 0
Accepted
time: 1646ms
memory: 110048kb

input:

abbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaabbaaaabbaabbaaaabbaabbaaaabbaabbaaaab...

output:

48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
48
...

result:

ok 50000 tokens

Test #37:

score: 0
Accepted
time: 1540ms
memory: 110876kb

input:

bbbbbbabaababbbbbbbbbbbbabaababbbbbbbbbbbbabaababbbbbbbbbbbbabaababbbbbbbbbbbbabaababbbbbbbabbbaabbaabbbabbbbbbbabaababbbbbbbbbbbbabaababbbbbbbbbbbbabaababbbbbbbbbbbbabaababbbbbbbbbbbbabaababbbbbbbbbbbbabaababbbbbbbbbbbbabaababbbbbbbbbbbbabaababbbbbbbbbbbbabaababbbbbbbbbbbbabaababbbbbbbabbbaabbaabbb...

output:

1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
1029
...

result:

ok 49950 tokens

Test #38:

score: 0
Accepted
time: 1239ms
memory: 114468kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998
199998...

result:

ok 49947 tokens

Test #39:

score: -30
Time Limit Exceeded

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

200000
200000
38385
38385
33776
33776
4138
200000
200000
200000
200000
78010
200000
200000
125726
125726
125726
125726
125726
125726
125726
125726
68615
68615
68615
40794
40794
40793
40793
199213
199213
194729
185537
185537
64215
64215
64215
64215
21860
21861
21861
21861
21861
21861
200000
192672
13...

result:


Subtask #6:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%