QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#453724 | #8701. Border | 2745518585 | 91 | 108ms | 45128kb | C++20 | 4.4kb | 2024-06-24 09:43:32 | 2024-06-24 09:43:33 |
Judging History
answer
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
inline char gc()
{
static char buf[100000],*p1=buf,*p2=buf;
return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
template<typename T> inline void read(T &x)
{
T u=1,t=0;char c=gc();
while(c<'0'||c>'9') {if(c=='-') u=-1; c=gc();}
while(c>='0'&&c<='9') t*=10,t+=c-'0',c=gc();
x=u*t;return;
}
template<typename T,typename ...O> inline void read(T &x,O &...o) {read(x),read(o...);}
template<typename T> inline void print(T x)
{
if(x==0) return putchar('0'),void();
if(x<0) putchar('-'),x=-x;
int c[129]={0},k=0;
while(x) c[++k]=x%10,x/=10;
for(int i=k;i;--i) putchar(c[i]+'0');
}
template<typename T,typename ...O> inline void print(T x,O ...o) {print(x),putchar(' '),print(o...);}
const int N=3000001;
int n,sa[N],rk[N],he[N],f[N],g[N];
char a[N],b[N];
namespace SA
{
int h[N],x1[N],x2[N];
void init(char a[])
{
int n=strlen(a+1),m=128;
for(int i=1;i<=n;++i)
{
++h[a[i]];
x1[i]=a[i];
}
for(int i=1;i<=m;++i) h[i]+=h[i-1];
for(int i=n;i>=1;--i) sa[h[x1[i]]--]=i;
for(int r=1;r<=n;r<<=1)
{
int p=0;
for(int i=n-r+1;i<=n;++i) x2[++p]=i;
for(int i=1;i<=n;++i) if(sa[i]>r) x2[++p]=sa[i]-r;
for(int i=1;i<=m;++i) h[i]=0;
for(int i=1;i<=n;++i) ++h[x1[i]];
for(int i=1;i<=m;++i) h[i]+=h[i-1];
for(int i=n;i>=1;--i) sa[h[x1[x2[i]]]--]=x2[i],x2[i]=0;
swap(x1,x2);
p=0;
x1[sa[1]]=++p;
for(int i=2;i<=n;++i)
{
if(x2[sa[i]]==x2[sa[i-1]]&&x2[sa[i]+r]==x2[sa[i-1]+r]) x1[sa[i]]=p;
else x1[sa[i]]=++p;
}
if(p==n) break;
m=p;
}
for(int i=1;i<=n;++i) rk[sa[i]]=i;
int p=0;
for(int i=1;i<=n;++i)
{
if(rk[i]==1) continue;
if(p>=1) --p;
int j=sa[rk[i]-1];
while(i+p<=n&&j+p<=n&&a[i+p]==a[j+p]) ++p;
he[rk[i]]=p;
}
}
}
namespace sgt
{
struct tree
{
int l,r,s;
}T[N<<2];
void pushup(int x)
{
T[x].s=min(T[x<<1].s,T[x<<1|1].s);
}
void build(int x,int l,int r)
{
T[x].l=l,T[x].r=r;
if(l==r)
{
T[x].s=he[l];
return;
}
int z=l+r>>1;
build(x<<1,l,z);
build(x<<1|1,z+1,r);
pushup(x);
}
int sum(int x,int l,int r)
{
if(T[x].l>=l&&T[x].r<=r)
{
return T[x].s;
}
int z=T[x].l+T[x].r>>1,s=1e9;
if(l<=z) s=min(s,sum(x<<1,l,r));
if(r>z) s=min(s,sum(x<<1|1,l,r));
return s;
}
};
int sum(int x,int y)
{
x=rk[x],y=rk[y];
if(x>y) swap(x,y);
return sgt::sum(1,x+1,y);
}
bool check(int x,int y,int t)
{
if(x>y) swap(x,y);
if(y<=t)
{
if(a[t-y+x]!=b[t]) return false;
if(sum(x,y)<t-y) return false;
if(t-x+y<=n)
{
if(b[t]!=a[t-x+y]) return false;
if(sum(t-y+x+1,t+1)<y-x-1) return false;
if(sum(t+1,t-x+y+1)<n-t+x-y) return false;
}
else
{
if(sum(t-y+x+1,t+1)<n-t) return false;
}
}
else if(x<=t)
{
if(t-x+y<=n)
{
if(b[t]!=a[t-x+y]) return false;
if(sum(x,y)<t-x) return false;
if(sum(t+1,t-x+y+1)<n-t+x-y) return false;
}
else
{
if(sum(x,y)<n-y+1) return false;
}
}
else
{
if(sum(x,y)<n-y+1) return false;
}
return true;
}
int main()
{
scanf("%s%s",a+1,b+1);
n=strlen(a+1);
SA::init(a);
sgt::build(1,1,n);
for(int i=1;i<=n-1;++i)
{
int p=sum(1,n-i+1)+1;
if(p==i+1)
{
g[i]=max(g[i],i);
continue;
}
if(check(1,n-i+1,p)) f[p]=max(f[p],i);
if(check(1,n-i+1,n-i+p)) f[n-i+p]=max(f[n-i+p],i);
}
for(int i=1;i<=n;++i) g[i]=max(g[i],g[i-1]);
for(int i=1;i<=n;++i)
{
if(a[i]==b[i]) print(g[n]),putchar('\n');
else print(max(f[i],g[min(i-1,n-i)])),putchar('\n');
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 23
Accepted
Test #1:
score: 23
Accepted
time: 11ms
memory: 38232kb
input:
cbaababaabacbaababaabacbaabacbaababaabacbaaba dabbababbabaabbafabbgbaabfebaabzababbayaabcac
output:
0 0 0 0 0 0 6 6 6 6 6 6 6 6 6 6 6 17 17 17 17 17 17 17 17 17 17 17 6 6 6 6 6 6 6 6 6 6 6 0 0 0 3 0 1
result:
ok 45 numbers
Test #2:
score: 0
Accepted
time: 7ms
memory: 38388kb
input:
cbaababaabacbaabadbaababaabacbaabacbaaba aabwaxjbbabtalbabcasbabibbabaabbabaabiac
output:
3 0 0 0 0 0 6 6 6 6 6 6 6 6 6 6 6 23 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 0 0 0 0 0 1
result:
ok 40 numbers
Test #3:
score: 0
Accepted
time: 7ms
memory: 36236kb
input:
cadaabacabacabacabaabacabacadaabacabacaba bbbbbabtbabababalalbawababababbaoababebdc
output:
2 0 4 0 0 0 0 0 0 0 0 0 0 0 0 15 15 15 15 15 15 15 15 15 15 15 0 0 0 0 0 0 0 0 0 0 0 0 0 4 1
result:
ok 41 numbers
Test #4:
score: 0
Accepted
time: 12ms
memory: 36180kb
input:
dabacbaadcbaadabacbaadabecbaadcbaadabacbaadabacbaa ababaabbyaarbabfbvdbuaoaaaabbaaabbababaabbababqadd
output:
2 0 0 0 0 0 0 0 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 29 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 0 0 0 0 0 0 2 1
result:
ok 50 numbers
Test #5:
score: 0
Accepted
time: 14ms
memory: 36300kb
input:
edacbcacacbcaecbcacacbcadacbcacacbca sabaaabtbaaabaaalblbawaeabaaababoaae
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 0 0 0 0 0 0 0 0 0 0 0 1
result:
ok 36 numbers
Test #6:
score: 0
Accepted
time: 8ms
memory: 38276kb
input:
cbaababaabacbaabacbaabdbaabacbaabacbaaba aabbababbaoaabbxbaabbaqabbabltbpagaabcac
output:
3 0 0 0 0 0 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 0 0 0 3 0 1
result:
ok 40 numbers
Subtask #2:
score: 31
Accepted
Dependency #1:
100%
Accepted
Test #7:
score: 31
Accepted
time: 22ms
memory: 36528kb
input:
abacadcabbacabbacabcabbacabacabbacabbacabcabbacabbacadcabbacabbacabcabbacabacabbacabbacabcabbacabbacadcabbacabbacabcabbacababacadcabbacabbacabcabbacabacabbacabbacabcabbacabbacadcabbacabbacaecabbacabacabbacabbacabcabbacabbacadcabbacabbacabcabbacababacadcabbacabbacabcabbacabacabbacabbacabcabbacabbacad...
output:
27 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75...
result:
ok 4623 numbers
Test #8:
score: 0
Accepted
time: 25ms
memory: 38544kb
input:
gcdcbcacacacbcacdcbcacaedcbcacacacbcacdcfcacacdcbcacaedcbcacacacbcacdcbcacacdcbcacacdcbcacacacbcacdcbcacaedcbcacacacbcacdcbcacacdcbcacacdcbcacacacbcacdcbcacaedcbcacacacbcacdcbcacacdcbcacagcdcbcacacacbcacdcbcacaedcbcacacacbcacdcbcacacdcbcacaedcbcacacacbcacdcbcacacdcbcacacdcbcacacacbcacdcbcacaedcbcaca...
output:
187 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 3182 numbers
Test #9:
score: 0
Accepted
time: 22ms
memory: 38392kb
input:
fbcababaabaababaababdababaabaababaababcababaababcababaabaababaababcababaababcababaabaababaababcababaababcababaabaababaababcababaabaababaababcababaababcababaabaababaababcababaababcababaabaababaababdababaabaababaababcababaababcababaabaababaababcababaababcababaabaababaababcababaababcababaabaabebaababda...
output:
103 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 4057 numbers
Test #10:
score: 0
Accepted
time: 19ms
memory: 40504kb
input:
accaeaabacabaabacabacabaabacabaabacdbacabaabacabaabacabacabaabacabaabacdbacabaabacabaabacabacabaabacabacabaabacabaabacabacabaabacabaabacdbacabaabacabaabacabacabaabacabacabaabacabaabacabacabaabacabaabacdbacabaabacabaabacabacabaabacabacabaabacabaabacabacabaabacabaabacdbacabaabacabaabacabacabaabacabaab...
output:
0 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 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 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 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 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 1 1 1 1 ...
result:
ok 4342 numbers
Test #11:
score: 0
Accepted
time: 27ms
memory: 36448kb
input:
fababaadabcababaababcababaabaababaababcababaabaababaababcababaebabcababaabaababaababcababaababcababaabaababaababcababaabaababaababcababaababcababaabaababaababcababaabaababaadabcababaababcababaabaababaababcababaabaababaababcababaababcababaabaababaababcababaabaababaadabcababaababcababaabaababaababcaba...
output:
517 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 3855 numbers
Test #12:
score: 0
Accepted
time: 27ms
memory: 40492kb
input:
hbfdabacabadcabadabacabadcabadabacabadabacabadcabadabacabaecabadabacabadabacabadcabadabacabadcabadabacabadabacabadcabadabacabafecabadabacabadabacabadcabadabacabadcabadabacabadabacabadcabadabacabafdabacabadcabadabacabadcabadabacabadabacabadcabadabacabaecabadabgcabadabacabadcabadabacabadcabadabacabada...
output:
1661 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
ok 4664 numbers
Test #13:
score: 0
Accepted
time: 22ms
memory: 38544kb
input:
fbcbaaabacbaaabacbaecbaaabacbaaabacbadcbaaabacbaaabacbaacbaaabacbaaabacbadcbaaabacbaaabacbaacbaaabacbaacbaaabacbaaabacbaacbaaabacbaaabacbadcbaaabacbaaabacbaacbaaabacbaaabacbadcbaaabacbaaabacbaacbaaabacbaacbaaabacbaaabacbaacbaaabacbaaabacbadcbaaabacbaaabacbaacbaaabacbaacbaaabacbaaabacbaacbaaabacbaaab...
output:
1633 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
ok 4299 numbers
Test #14:
score: 0
Accepted
time: 26ms
memory: 36584kb
input:
acabbacabbacabcabbacabbacadcaebacabbacabcabbacabbacadcabbacabbacabcabbacabcabbacabbacabcabbacabbacadcabbacabbacabcabbacabcabbacabbacabcabbacabbacadcabbacabbacabcabbacabacabbacabbacabcabbacabbacadcabbacabbacabcabbacabbacadcabbacabbacabcabbacabcabbacabbacabcabbacabbacadcabbacabbacabcabbacabcabbacabbac...
output:
168 2 0 0 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:
ok 4512 numbers
Test #15:
score: 0
Accepted
time: 19ms
memory: 36348kb
input:
afabacabacabaabacabaabadabacabaabacabaabacabaabadabacabaabacabaabacabaabacabacabaabacabaabadabacabaabacabaabacabaabadabacabaabecabaabacabaabacabacabaabacabaabadabacabaabacabaabacabaabadabacabaabacabaabacabaabacabacabaabacabaabadabacabaabacabaabacabafabadabacabaabecabaabacabaabacabacabaabacabaabadaba...
output:
0 5 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 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 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 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 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 1 1 1 ...
result:
ok 3912 numbers
Test #16:
score: 0
Accepted
time: 21ms
memory: 38412kb
input:
cbdaabacbaecbaacbaaabacbaacbdaabacbaacbaacbdaabacbaacbaacbaaabacbaacbdaabacbaacbaacbaaabacbaacbdaabacbaacbaacbdaabacbaacbaacbaaabacbaacbdaabfcbaacbaacbdaabacbaecbaacbaaabacbaacbdaabacbaacbaacbdaabacbaacbaacbaaabacbaacbdaabacbaacbaacbaaabacbaacbdaabacbaacbaacbdaabacbaacbaacbaaabacbaacbdaabacbaacbaacb...
output:
1 0 4 0 0 0 0 0 0 0 41 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 82 ...
result:
ok 3435 numbers
Test #17:
score: 0
Accepted
time: 25ms
memory: 38344kb
input:
dcbeacacbcadcacbcadcbcacacbcadcbcacacbcadcacbcadcbcacfcbcadcacbcadcbcacacbcadcbcacacbcadcacbcadcbcacacbcadcbeacacbcadcacbcadcbcacacbcadcbcacacbcadcacbcadcbcacacbcadcbeacacbcadcacbcadcbcacacbcadcbcacacbcadcacbcadcbcacacbcadcbeacacbcadcacbcadcbcacacbcadcbcacacbcadcacbcadcbcacacbcadcacbcadcbcacacbcadcb...
output:
1 0 0 29 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 58 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 3688 numbers
Subtask #3:
score: 37
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Test #18:
score: 37
Accepted
time: 54ms
memory: 41196kb
input:
gcbacbbdacbbbacbacbbbacbacbbbacbacbbbacbbbacbacbbbacbacbbdacbbbacbacbbbacbacbbbacbacbbdacbbbacbacbbbacbaebbbacbacbbbacbbbacbacbbbacbacbbdacbbbacbacbbbacbacbbbacbacbbdacbbbacbacbbbacbacbbbacbacbbdacbbbacbacbbbacbaebbbacbacbbbacbbbacbacbbbacbacbbdacbbbacbacbbbacbacbbbacbacbbdacbbbacbacbbbacbacbbbacbac...
output:
188 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 61972 numbers
Test #19:
score: 0
Accepted
time: 75ms
memory: 39868kb
input:
afcbdaabacbaacbaaabacbaaabacbaacbaaabacbaacbdaabacbaacbaaabacbaaabacbaacbaaabacbaacbdaabacbaacbaaabacbaacbdaabacbaacbaaabacbaaabacbaacbaaabacbaacbdaabacbaacbaaabacbaaabacbaacbaaabecbaacbdaabacbaacbaaabacbaacbdaabacbaacbaaabacbaaabacbaacbaaabacbaacbdaabacbaacbaaabacbaaabacbaacbaaabacbaacbdaabacbaacba...
output:
0 166 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 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 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 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 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 1 1 ...
result:
ok 79055 numbers
Test #20:
score: 0
Accepted
time: 84ms
memory: 39800kb
input:
gcbaaaabaabaabaaaabacbaaaabaabaabaaaabacbaaaabaabacbaaaabaabaabaaaabacbaaaabaabaabaaaabdcbaaaabaabacbaaaabaabaabaaaabacbaaaabaabaabaaaabacbaaaabaabacbaaaabaabaabaaaabacbaaaabaabaabaaaabdcbaaaabaabacbaaaabaabaabaaaabacbaaaabaabaabaaaabacbaaaabaabacbaaaabaabaabaaaabacbaaaabaabacbaaaabaabaabaaaabacbaaa...
output:
2555 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
ok 89092 numbers
Test #21:
score: 0
Accepted
time: 65ms
memory: 41404kb
input:
ieabacbaacbafabacbaaabacbdacbaaabacbaaabacbaaeabacbdacbaaabacbaaabacbaaeabacbaacbaaabacbaaabacbdacbaaabacbaaabacbaaeabacbaacbaaabacbaaabacbdacbaaabacbaaabacbaaeabacbdacbaaabacbaaabacbaaeabacbaacbaaabacbaaabacbdacbaaabacbaaabacbaaeabacbdacbaaabacbaaabacbaaeabacbaacbaaabacbaaabacbdacbaaabacbaaabacbaae...
output:
3885 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
ok 83355 numbers
Test #22:
score: 0
Accepted
time: 83ms
memory: 44812kb
input:
fcdbbacabcabbecabbacabcabbacabcdbbacabcabbacabcdbbacabcabbacabcdbbacabcabbacabbacabcabbacabcdbbacabcabbacabcdbbacabcabbecabbacabcabbacabcdbbacabcabbacagcdbbacabcabbacabfcdbbacabcabbacabbacabcabbacabcdbbacabchbbacabcdbbacabcabbecabbacabcabbacabcdbbacabcabbacabcdbbacabcabbacabfcdbbacabcabbecabbacabcab...
output:
62 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
ok 91682 numbers
Test #23:
score: 0
Accepted
time: 69ms
memory: 40888kb
input:
adabacbaadcbaadabacbaadabaceaadcbaadabacbaafabacbaadabaceaadcbaadabacbaadabacbaadabacbaadcbaadabacbaadabaceaadcbaadhbacbaadabacbaadabacbaadcbaadabacbaadabaceaadcbaadabacbaadabacbaadabacbaadcbaadabacbaadabaceaadcbaadabacbaadabacbaadabaceaadcbaadabacbaadabacbaadabacbaadcbaadabacbaadabaceaadcbaadabacba...
output:
0 2 1 1 1 1 1 1 1 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 51 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 1154 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ...
result:
ok 63269 numbers
Test #24:
score: 0
Accepted
time: 107ms
memory: 44252kb
input:
bdcabcabbacabbacabcaebacabcabbacabbacabcabbacabbdcabcabbacabbacabcabbacabbdcabcabbacabbacabcabbacabcabbacabbacabcabbacabbdcabcabbacabbacabcabbacabcabbacabbacabcabbacabbdcabcabbacabbacabcabbacabbdcabcabbacabbacabcabbacabcabbacabbacabcabbacabbdcabcabbacabbacabcabbacabbdcabcabbacabbacabcaebacabcabbacab...
output:
0 13 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 73 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 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 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 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 1 1 1 1 1 1 1 1 1 146 14...
result:
ok 99060 numbers
Test #25:
score: 0
Accepted
time: 108ms
memory: 44192kb
input:
aababaabebcababadbabcababaabaababaababcababaabaababaababcababaababcababaabaababaababcababaababcababaabaababaababcababaabaababaababcababaababcababaabaababaababcababaabaababaababcababadbabcababaabaababaababcababaabaababaababcababaababcababaabaababaababcababaabaababaababcababadbabcababaabaababaababcaba...
output:
2 1 1 1 4 4 4 4 93 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:
ok 82370 numbers
Test #26:
score: 0
Accepted
time: 81ms
memory: 44664kb
input:
cdbaeacbacbacbacacbadbacacbacbadbacacbacbacdbacacbacbacbacacbadbacacbacbadbaeacbacbacbacacbadbacacbacbadbacacbacbacdbacacbacbacbacacbadbacacbacbadbaeacbacbacbacacbadbacacbacbadbacacbacbacdbaeacbacbacbacacbadbacacbacbadbacacbacbacdbacacbacbacbacacbadbacacbacbadbaeacbacbacbacacbadbacacbacbadbacacbacba...
output:
42 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114 114...
result:
ok 93324 numbers
Test #27:
score: 0
Accepted
time: 96ms
memory: 42864kb
input:
bbabbbabcbbbababbcbbbdbababbbabcbbbababbcbbbabababbbabcbbbababbabbbabcbbbababbcbbbabababbbabcbbbababbabbbabcbbbababbcbbbabababbbabcbbbababbcbbbabababbbabcbbbfbabbabbbabcbbbababbcbbbabababbbabcbbbababbcbbbabababbbabcbbbababbabbbabcbbbababbcbbbabababbbabcbbbababbabbbabcbbbababbcbbbabababbbabcbbbababbc...
output:
15 2 0 0 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 99 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 80812 numbers
Test #28:
score: 0
Accepted
time: 73ms
memory: 44456kb
input:
ebcadbbacabbbacabbcabbbacabbcabbbacabbbacabbcabbbacabbbacabbcabbbacabbcabbbacabbbacabbcabbbacabbcadbbacabbbacabbcabbbacabbcabbbacabbbacabbcabbbacabebbacabbcabbbacabbcabbbacabbbacabbcabbbacabbcadbbacabbbacabbcabbbacabbcabbbacabbbacabbcabbbacabebcadbbacabbbacabbcabbbacabbcabbbacabbbacabbcabbbacabbbaca...
output:
53 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 147 1...
result:
ok 83614 numbers
Test #29:
score: 0
Accepted
time: 85ms
memory: 42220kb
input:
abbdbababbbacabbbababbbacabbbababbbabbbaeabbbacabbbababbbabbbababbbacabbbababbbacabbbababbbabbbababbbacabbbababbbacabbbababbbabbbababbbacabbbababbbabbbababbbacabbbababbbacabbbababbbabbbababbbacabbbababbbabdbababbbacabbbababbbacabbbababbbabbbababbbacabbbababbbabbbababbbacabbbababbbacabbbababbbabbbaba...
output:
0 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 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 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 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 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 1 1 1 1 ...
result:
ok 68245 numbers
Test #30:
score: 0
Accepted
time: 64ms
memory: 41540kb
input:
cbaababaabacbaababaabacbaabacbaababaabacbaababaabacdaabacbaababaabacbaababaabacbaabacbaababaabacbaababaabacdaabacbaababaabacbaababaabacbaabacbaababaabacbaabacbaababaabacbaababaabacbaabacbaababaabacbaababaabacdaabacbaababaabacbaababaabacbaabacbaababaabacbaababaabacdaabacbaababaabacbaababaabacbaabacba...
output:
3 0 0 0 0 0 6 6 6 6 6 6 6 6 6 6 6 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 101 101 101 10...
result:
ok 71812 numbers
Test #31:
score: 0
Accepted
time: 79ms
memory: 45128kb
input:
ebbcabababbaababcabababbaabfbcabababbcabababbaababcabababbaababcadababbcabababbaababcabababbaababcabababbcabababbaababcababaebbaababcadababbcabababbaababcabababbaababcabababbcabababbaababcababaebbcabababbaababcabababbaababcabababgcabababbaababcabababbaababcadababbcabababbaababcabababbaababcabababbca...
output:
22 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 124 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
ok 89746 numbers
Test #32:
score: 0
Accepted
time: 88ms
memory: 44312kb
input:
adabacabedcabadabacfbadabacabadcabadabacabadcabadabacabadabacabadcabadabacabadabacabedcabadabacabadabacabadcabadabacabadabacabedcabadabacabadabacabadcabadabacabadcabadabacabadabacabadcabadabacabadabacabedcabadabacabadabacabadcabadabacabadcabadabacabadabacabadcabadabacabadabacabedcabadabacabadabacaba...
output:
0 5 1 1 1 1 1 1 9 1 1 1 1 1 1 1 1 1 1 119 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 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 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 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 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok 86655 numbers
Test #33:
score: 0
Accepted
time: 88ms
memory: 44272kb
input:
cbaabaababaababcabaababaababaababcabaababaababaababaabaababaababcabaababaababaababcabaababaabadaababaabaababaababcabaababaababaababcabaababaababaababaabaababaababcabaababaababaababcabaababaabadaababaabaababaababcabaababaababaababcabaababaababaababaabaababaababcabaababaababaababaabaababaababcabaababa...
output:
6749 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
result:
ok 99407 numbers
Test #34:
score: 0
Accepted
time: 76ms
memory: 44600kb
input:
cbadaeacbaacbaacbaaabacbaacbadabacbaacbaacbadabacbaacbaacbaaabacbaafbadabacbaacbaacbaaabacgaacbadabacbaacbaacbadabacbaacbaacbaaabacbaacbadabacbaacbaacbadaeacbaacbaacbaaabacbaacbadabacbaacbaacbadabacbaacbaacbaaabacbaacbadabacbaacbaacbadaeacbaacbaacbaaabacbaacbadabacbaacbaacbadabacbaacbaacbaaabacbaacb...
output:
1 0 0 4 0 41 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 82 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 462 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 76996 numbers
Subtask #4:
score: 0
Time Limit Exceeded
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Test #35:
score: 0
Time Limit Exceeded
input:
akhebabacbaacbaaabacbaacdaaabacbaacbaaabacbaabcdaaafacbaacbaaabacbaababacbaacbaaabacbaacdaaabacbaacbaaabacbaaebcdaaabacbaacbaaabacbaababacbaacbaaabacbaacdaaabacbaacbaaabacbaababacbaacbaaabacbaacdaaabacbaacbaaabacbaabcdaaabacbaacbaaabacbaababacbaacbaaabacbaacdaaabacbaacbaaabacbaaebcdaaabacbaacbaaabac...