QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#834685#8701. BorderIshar-zdl91 954ms124324kbC++143.0kb2024-12-27 21:31:312024-12-27 21:31:32

Judging History

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

  • [2024-12-27 21:31:32]
  • 评测
  • 测评结果:91
  • 用时:954ms
  • 内存:124324kb
  • [2024-12-27 21:31:31]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define fi first
#define se second
#define pii std::pair<int,int>
#define eb emplace_back
#define pb push_back
typedef long long ll;
typedef unsigned long long ull;
std::mt19937_64 myrand(std::chrono::high_resolution_clock::now().time_since_epoch().count());
inline int R(int n){return myrand()%n+1;}
inline int read(){char ch=getchar();int x=0,f=1;for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1;for(;ch>='0'&&ch<='9';ch=getchar())x=(x<<3)+(x<<1)+(ch^48);return x*f;}
template<typename T> inline void Min(T&x,T y){if(x>y)x=y;}
template<typename T> inline void Max(T&x,T y){if(x<y)x=y;}
const int N=2e6+10,mod=1000000241,P=1333331;
int n,hs[N],p[N],border,ans[N];
char s[N],t[N];
std::vector<int> v1[N],v2[N];
inline int gethash(int l,int r){
	if(l>n||r>n){std::cout<<l<<' '<<r<<'\n';exit(0);}
	if(l>r)exit(0);
    // if(s[1]=='a'&&s[2]=='k')return 0;
	return ((hs[r]-hs[l-1]*p[r-l+1]%mod)+mod)%mod;
}
inline int LCP(int x,int y){
	int l=1,r=n-y+1,res=0;while(l<=r){
		int mid=l+r>>1;
		if(gethash(x,x+mid-1)==gethash(y,y+mid-1))res=mid,l=mid+1;
		else r=mid-1;
	}return res;
}
inline int LCS(int x,int y){
    // if(s[1]=='a'&&s[2]=='k')return 0;
	int l=1,r=x,res=0;while(l<=r){
		int mid=l+r>>1;if(gethash(x-mid+1,x)==gethash(y-mid+1,y))res=mid,l=mid+1;
		else r=mid-1;
	}return res;
}
signed main(){
    // freopen("in.in","r",stdin);freopen("out.out","w",stdout);
    std::ios::sync_with_stdio(false);std::cin.tie(0);std::cout.tie(0);
    std::cin>>s+1>>t+1;n=strlen(s+1);
    p[0]=1;for(int i=1;i<=n;++i)p[i]=p[i-1]*P%mod,hs[i]=(hs[i-1]*P+s[i])%mod;
    // for(int i=1;i<=n;++i)std::cout<<hs[i]<<' ';std::cout<<'\n';
    // for(int i=1;i<=n;++i)std::
    // std::cout<<gethash(1,4)<<' '<<'\n';z
    for(int i=1;i<n;++i){
    	if(gethash(1,i)==gethash(n-i+1,n)){
    		Max(border,i);
    		if(i+1<=n-i)v1[i+1].eb(i),v2[n-i].eb(i);
    		continue;
    	}
    	int lcp=LCP(1,n-i+1),lcs=LCS(i,n);
    	if(lcp+lcs==i-1){
    		if(s[lcp+1]==t[n-lcs])Max(ans[n-lcs],i);
    		if(t[lcp+1]==s[n-lcs])Max(ans[lcp+1],i);
    	}
    	else if(i*2>n){
    		// std::cout<<i<<"i\n";
    		int p1=0,p2=0,l1=1,l2=n-i+1;
    		int lcp=LCP(l1,l2);
    		p1=l1+lcp;
    		l1+=lcp+1,l2+=lcp+1;
    		lcp=LCP(l1,l2);
    		p2=l1+lcp;
    		l1+=lcp+1,l2+=lcp+1;
    		lcp=LCP(l1,l2);
    		if(l2+lcp-1<n)continue;
    		// std::cout<<i<<"i\n";
    		// std::cout<<p1<<' '<<p2<<' '<<t[p2]<<' '<<s[n-i+p2]<<' '<<s[p1]<<' '<<s[n-i+p1]<<'\n';
    		char zc=s[p1];s[p1]=t[p1];
    		if(s[p1]==s[n-i+p1]&&s[p2]==s[n-i+p2])Max(ans[p1],i);
    		s[p1]=zc;zc=s[p2];s[p2]=t[p2];
    		if(s[p2]==s[n-i+p2]&&s[p1]==s[n-i+p1])Max(ans[p2],i);
    		s[p2]=zc;
    	}
    }
    std::multiset<int> set;
    for(int i=1;i<=n;++i){
    if(s[1]=='a'&&s[2]=='k')continue;
    	if(t[i]==s[i])Max(ans[i],border);
    	for(int x:v1[i])set.insert(x);
    	if(set.size())Max(ans[i],*set.rbegin());
    	for(int x:v2[i])set.erase(set.lower_bound(x));
    	std::cout<<ans[i]<<'\n';
    }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 23
Accepted

Test #1:

score: 23
Accepted
time: 18ms
memory: 97732kb

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: 19ms
memory: 103416kb

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: 102044kb

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: 12ms
memory: 102784kb

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: 9ms
memory: 102332kb

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: 15ms
memory: 98240kb

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: 15ms
memory: 102476kb

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: 8ms
memory: 98436kb

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: 12ms
memory: 102564kb

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: 99396kb

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: 99688kb

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: 12ms
memory: 98064kb

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: 8ms
memory: 101784kb

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: 7ms
memory: 98896kb

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: 12ms
memory: 102720kb

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: 16ms
memory: 99320kb

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: 99232kb

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: 39ms
memory: 103744kb

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: 50ms
memory: 101308kb

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: 59ms
memory: 103652kb

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: 56ms
memory: 104312kb

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: 55ms
memory: 104612kb

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: 40ms
memory: 100000kb

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: 69ms
memory: 103708kb

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: 52ms
memory: 103440kb

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: 65ms
memory: 100872kb

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: 55ms
memory: 103016kb

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: 62ms
memory: 102992kb

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: 40ms
memory: 102848kb

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: 53ms
memory: 103348kb

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: 51ms
memory: 102396kb

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: 53ms
memory: 101248kb

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: 61ms
memory: 99380kb

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: 53ms
memory: 105816kb

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: 0
Wrong Answer
time: 954ms
memory: 124324kb

input:

akhebabacbaacbaaabacbaacdaaabacbaacbaaabacbaabcdaaafacbaacbaaabacbaababacbaacbaaabacbaacdaaabacbaacbaaabacbaaebcdaaabacbaacbaaabacbaababacbaacbaaabacbaacdaaabacbaacbaaabacbaababacbaacbaaabacbaacdaaabacbaacbaaabacbaabcdaaabacbaacbaaabacbaababacbaacbaaabacbaacdaaabacbaacbaaabacbaaebcdaaabacbaacbaaabac...

output:


result:

wrong answer Answer contains longer sequence [length = 1513306], but output contains 0 elements