QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#853435 | #8701. Border | ChiFAN | 91 | 984ms | 135692kb | C++14 | 3.7kb | 2025-01-11 17:00:44 | 2025-01-11 17:00:46 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod = 1e9+7;
const int maxn = 2e6+114;
mt19937 rd(time(0));
int to[26];
inline int qpow(int a,int b){
int res=1;
for(int i=0;i<33;i++){
if((1ll<<i)&b) res=res*a%mod;
a=a*a%mod;
}
return res;
}
vector<int> solve(string s,string t){
int n=s.size();
array<int,maxn> S,T;
for(int i=1;i<=n;i++) S[i]=to[s[i-1]-'a'],T[i]=to[t[i-1]-'a'];
array<int,maxn> v1,v2,v3;
vector<int> ans;
ans.resize(n+1);
for(int i=1;i<=n;i++){
v1[i]=(v1[i-1]+S[i])%mod;
v2[i]=(v2[i-1]+S[i]*S[i]%mod)%mod;
v3[i]=(v3[i-1]+S[i]*i%mod)%mod;
}
array<int,maxn> suf;
for(int i=1;i<n;i++){
vector<int> pos;
bool flag=true;
for(int j=2;i*(j-1)+1<=n;j++){
if(pos.size()==2){
flag=false;
break;
}
int L=(j-1)*i+1,R=j*i;
int l=1,r=i;
if(R>n){
int c=R-n;
R-=c,r-=c;
}
bool f=true;
for(int k=1;k<=4;k++){
int p=rd()%(r-l+1);
if(S[l+p]!=S[L+p]) f=false;
}
if(f==true&&(v1[r]+mod-v1[l-1])%mod==(v1[R]+mod-v1[L-1])%mod&&(v3[r]+mod-v3[l-1])%mod==((v3[R]+mod-v3[L-1])%mod+mod-(L-l)*((v1[R]+mod-v1[L-1])%mod)%mod)%mod) continue;
else{
int c1=(v2[r]+v2[L-1]+2*mod-v2[l-1]-v2[R])%mod,c2=(v1[r]+v1[L-1]+2*mod-v1[l-1]-v1[R])%mod;
c1=c1*qpow(c2,mod-2)%mod;
int x=(c1+c2)%mod*((mod+1)/2)%mod;
int y=(c1+mod-c2)%mod*((mod+1)/2)%mod;
int c3=(v3[R]+mod-v3[L-1])%mod;
c3=(c3+mod-(L-l)*((v1[R]+mod-v1[L-1])%mod)%mod)%mod;
int pd=((v3[r]+mod-v3[l-1])%mod+mod-c3)%mod;
int p=pd*qpow((x+mod-y)%mod,mod-2)%mod;
if(p<1||p>n){
flag=false;
break;
}
if(S[p]!=x){
flag=false;
break;
}
if(p+(L-l)>n){
flag=false;
break;
}
if(S[p+(L-l)]!=y){
flag=false;
break;
}
if(pd!=p*((x+mod-y)%mod)%mod){
flag=false;
break;
}
if(T[p+(L-l)]!=x){
flag=false;
break;
}
pos.push_back(p+(L-l));
}
}
if(flag==false) continue;
if(pos.size()==1){
ans[pos[0]]=max(ans[pos[0]],n-i);
}else if(pos.size()==0&&i*2>=n){
suf[i]=max(suf[i],n-i);
}
}
for(int i=n-1;i>=1;i--) suf[i]=max(suf[i],suf[i+1]);
for(int i=1;i<=n;i++) ans[i]=max(ans[i],suf[max(i,n-i+1)]);
return ans;
}
signed main(){
for(int i=0;i<26;i++) to[i]=rd()%mod;
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
string s,t;
cin>>s>>t;
vector<int> ans=solve(s,t);
reverse(s.begin(),s.end());
reverse(t.begin(),t.end());
vector<int> oth=solve(s,t);
reverse(oth.begin(),oth.end());
vector<int> nxt;
nxt.resize(s.size());
reverse(s.begin(),s.end());
reverse(t.begin(),t.end());
nxt[0]=-1;
for(int i=1;i<s.size();i++){
int z=nxt[i-1];
while(s[z+1]!=s[i]&&z>-1) z=nxt[z];
if(s[z+1]==s[i]) z++;
nxt[i]=z;
}
for(int i=0;i<s.size();i++){
if(s[i]==t[i]) cout<<nxt[s.size()-1]+1<<'\n';
else cout<<max(ans[i+1],oth[i])<<'\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: 4ms
memory: 97456kb
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: 23
Accepted
time: 8ms
memory: 97432kb
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: 23
Accepted
time: 11ms
memory: 97700kb
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: 23
Accepted
time: 0ms
memory: 97444kb
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: 23
Accepted
time: 0ms
memory: 97392kb
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: 23
Accepted
time: 0ms
memory: 97392kb
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: 11ms
memory: 97756kb
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: 31
Accepted
time: 4ms
memory: 97520kb
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: 31
Accepted
time: 11ms
memory: 97508kb
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: 31
Accepted
time: 11ms
memory: 97588kb
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: 31
Accepted
time: 7ms
memory: 97576kb
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: 31
Accepted
time: 3ms
memory: 97540kb
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: 31
Accepted
time: 11ms
memory: 97584kb
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: 31
Accepted
time: 3ms
memory: 97584kb
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: 31
Accepted
time: 3ms
memory: 97572kb
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: 31
Accepted
time: 3ms
memory: 97480kb
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: 31
Accepted
time: 7ms
memory: 97532kb
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: 36ms
memory: 98768kb
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: 37
Accepted
time: 52ms
memory: 99216kb
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: 37
Accepted
time: 53ms
memory: 99484kb
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: 37
Accepted
time: 55ms
memory: 99204kb
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: 37
Accepted
time: 61ms
memory: 99556kb
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: 37
Accepted
time: 51ms
memory: 98752kb
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: 37
Accepted
time: 62ms
memory: 99824kb
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: 37
Accepted
time: 47ms
memory: 99268kb
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: 37
Accepted
time: 57ms
memory: 99492kb
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: 37
Accepted
time: 53ms
memory: 99392kb
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: 37
Accepted
time: 51ms
memory: 99216kb
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: 37
Accepted
time: 37ms
memory: 98960kb
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: 37
Accepted
time: 40ms
memory: 98940kb
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: 37
Accepted
time: 55ms
memory: 99496kb
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: 37
Accepted
time: 58ms
memory: 99480kb
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: 37
Accepted
time: 70ms
memory: 99944kb
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: 37
Accepted
time: 48ms
memory: 99292kb
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
Wrong Answer
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Test #35:
score: 9
Accepted
time: 984ms
memory: 135692kb
input:
akhebabacbaacbaaabacbaacdaaabacbaacbaaabacbaabcdaaafacbaacbaaabacbaababacbaacbaaabacbaacdaaabacbaacbaaabacbaaebcdaaabacbaacbaaabacbaababacbaacbaaabacbaacdaaabacbaacbaaabacbaababacbaacbaaabacbaacdaaabacbaacbaaabacbaabcdaaabacbaacbaaabacbaababacbaacbaaabacbaacdaaabacbaacbaaabacbaaebcdaaabacbaacbaaabac...
output:
0 102242 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 1513306 numbers
Test #36:
score: 0
Wrong Answer
time: 876ms
memory: 133320kb
input:
bacbaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababacbaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababacbaababdabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaab...
output:
1 0 34 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 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 68 6...
result:
wrong answer 5396th numbers differ - expected: '2577', found: '608094'