QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#560855#8223. 字符串游戏syp1160 329ms402396kbC++141.6kb2024-09-12 18:24:392024-09-12 18:24:39

Judging History

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

  • [2024-09-12 18:24:39]
  • 评测
  • 测评结果:60
  • 用时:329ms
  • 内存:402396kb
  • [2024-09-12 18:24:39]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N=2e6+10;
int n,lst=1,tot=1,cnt,fa[N],len[N],id[N],pi[N],po[N],tr[N],f[N][21],ch[N][26],dp[N];
string s;
vector<int>a[N];
void insert(int c,int i)
{
	int p=lst;
	int u=++tot;
	lst=id[i]=u;
	len[u]=len[p]+1;
	while(p&&!ch[p][c])
	{
		ch[p][c]=u;
		p=fa[p];
	}
	if(!p)
	{
		fa[u]=1;
		return;
	}
	int q=ch[p][c];
	if(len[p]+1==len[q])
	{
		fa[u]=q;
		return;
	}
	int nq=++tot;
	copy_n(ch[q],26,ch[nq]);
	fa[nq]=fa[q];
	len[nq]=len[p]+1;
	fa[u]=fa[q]=nq;
	while(p&&ch[p][c]==q)
	{
		ch[p][c]=nq;
		p=fa[p];
	}
	return;
}
void dfs(int x)
{
	pi[x]=++cnt;
	f[x][0]=fa[x];
	for(int i=1;i<21;i++)
	{
		f[x][i]=f[f[x][i-1]][i-1];
	}
	for(auto y:a[x])
	{
		dfs(y);
	}
	po[x]=cnt;
	return;
}
int ask(int x)
{
	int res=0;
	for(;x;x-=x&-x)
	{
		res+=tr[x];
	}
	return res;
}
int occ(int l,int r)
{
	int u=id[r];
	for(int i=20;~i;i--)
	{
		if(f[u][i]&&len[f[u][i]]>r-l)
		{
			u=f[u][i];
		}
	}
	return ask(po[u])-ask(pi[u]-1);
}
signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>s;
	n=s.size();
	for(int i=1;i<=n;i++)
	{
		insert(s[n-i]-'a',i);
	}
	for(int i=2;i<=tot;i++)
	{
		a[fa[i]].push_back(i);
	}
	dfs(1);
	stack<int>st;
	for(int i=1;i<=n;i++)
	{
		for(int x=pi[id[i]];x<=tot;x+=x&-x)
		{
			tr[x]++;
		}
		dp[i]=1;
		for(;!st.empty();st.pop())
		{
			int j=st.top();
			dp[i]=max(dp[i],occ(j+1,i)-dp[j]);
			if(dp[i]>dp[j])
			{
				break;
			}
		}
		st.push(i);
	}
	cout<<dp[n]<<flush;
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 12ms
memory: 66288kb

input:

abbabbbbabbaaaaabbbaabaaaaaabbbaabbabababaabababaababaaaaaabaaabaaabbbbababaaabbbabababbbabbbaabaaababbbaabaabbaaabbababaaaaabbbaabaaabbaabaabaaabaaabaababaabbbbbbbbabbbbbabbbaabababbaababbbbbabbbbaaabbaabaabaaabbabbaaabbaaababaabbbaabbbaaaabbababbabaababababaaaabbaaaabaabaaaababaaabababbbaaabababbb...

output:

1281

result:

ok single line: '1281'

Test #2:

score: 10
Accepted
time: 4ms
memory: 66260kb

input:

aaaabababbabbbbbabbbbbbbbbbbabbbbbabbbaaabbbbaababaabbbbbbbbbbbbbabaabbaaabaababaabaaabbabbbabbbabaabbaabaababbbbbbaaabbbbaaabaabbbabbbabbabaabbbbabbbaabaaaabbbbbabaaaabaabbabaaabbaabbabbaaabbabaaababbababababaabaaaabaabaabaaabaabbbabbbbbaababbabbbabbbbababaaabbabbaaaabbbaaabaabbbaaaaaababaababbbbba...

output:

1483

result:

ok single line: '1483'

Test #3:

score: 10
Accepted
time: 7ms
memory: 66808kb

input:

bbaaababbbabbbaabbbbbbababbbabbbbbbbbaabbbbbbbbbbaaabbbbbbbbbbbbbbbabbabbbabaababbbabbbbabbabbabbbbabbbbbbbbbaaababbaaabbbaabbabbbbbbbbbbbbbbbbbbbbabbbbbbababababbbbbbbbbabababaabbbbbbabbbbaabbababbaaababbbbabbbbabbbabbbbbabbbbbabbbbbbbbbbabbaabbbabababbbbaababbbababbbbabbabbaabbbbbbabbbbbababbbbaba...

output:

2310

result:

ok single line: '2310'

Test #4:

score: 10
Accepted
time: 12ms
memory: 68340kb

input:

abbbbbbbbababbbbbbbbbabbbbbbbbabbbabbbbbaaabbbbbabbbbababbbabbbbbbaabbabbbbbaabbbbabbabbbbbbbabbbbaaabbbbbbaabbbbbbbbbbbbbbbbbbbbbabbbabbbabbbbbbbabbbbbbbabbbabbbbbbbbabbbabbbbbbbbbbbbbbbbbaababbbbbbbbbbabbbbbbbbbbbbbababbbbbbbabbbbbbababbbabbbbbaabbbbbbbbbaabbabbbbaabbbabbbbbbbbbbbbbabbbbbbbbbbbbbb...

output:

1

result:

ok single line: '1'

Test #5:

score: 10
Accepted
time: 3ms
memory: 65292kb

input:

bbbabbbbbbbbbbbbbbbbbbbbabbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbabbbabbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbabbbbbbbbbabbbbabbabbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbabbbbbbbbbbbabbbbbbbbbbbbbbbbbbbabbbbbbabbabbbbbbaabbbabbbbbbbbbbbbbbbbabbbbbabbbabbbbbbbabbbababbabbbbba...

output:

3680

result:

ok single line: '3680'

Test #6:

score: 10
Accepted
time: 7ms
memory: 68928kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbb...

output:

2454

result:

ok single line: '2454'

Test #7:

score: 10
Accepted
time: 7ms
memory: 66368kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

2702

result:

ok single line: '2702'

Test #8:

score: 10
Accepted
time: 3ms
memory: 65220kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

2499

result:

ok single line: '2499'

Test #9:

score: 10
Accepted
time: 7ms
memory: 66776kb

input:

amahaaajakalaiacabararasafaxasagamajaqagaqaeauauayagasadazavaeagabaaajalajavalatauapacaearaeagafawaaapawadaiaaapalahanavazasayamaiafagabahaxanacaaagaoadasakayagawaiaharanamaraiaramazaoagajataoazasalavatafaoalacaqavanafatajawauayakaoaqawawayasatasazagafacayasasawaqayadasaiazaxamaaaragataxawazadalaxak...

output:

2475

result:

ok single line: '2475'

Test #10:

score: 10
Accepted
time: 11ms
memory: 65652kb

input:

afabagadaeaeacaeaeafagafagababaaagacabaaagadacafadabaaaaacadaaagafacagadaeacacacabadagadaaabafadafadadaeafaaagadafabaeaaafaeaeaaaeabaaabaaaeafagadaaaaacaeaaaaacabaeacadagafafacacabaeaaagagaeaaadagabadaaaaagafagaaabaaaaafacafacadaaagabaaafadagacaaafafadadadacadadaaacagabacaaabacaeadabacagaeagagafafag...

output:

2807

result:

ok single line: '2807'

Subtask #2:

score: 0
Memory Limit Exceeded

Test #11:

score: 0
Memory Limit Exceeded

input:

aaaaaaabbaaabbbbabbabbbababaabaaabaabbaaababaaaaaabbbbbaabbbabbbaabbabaababaababaabbbababbbabaaaaaaaaabaaaaabbbabbbbbabaaabaaaababbabbbbbbaabbbbbaababbbbababbbbbbbbbbbaaabbabbaababbaaaabbabaaabbaaabbbbaaababbbbbabbaababbaaababaaabbabaabbbbabbaaabbababbaabbaaaaaaaaaabababbbaaaababbabbbabbababbabbabbb...

output:

234567

result:


Subtask #3:

score: 0
Memory Limit Exceeded

Test #16:

score: 0
Memory Limit Exceeded

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

493827

result:


Subtask #4:

score: 25
Accepted

Test #17:

score: 25
Accepted
time: 87ms
memory: 180280kb

input:

bbbbbbbbbaabbbbbabaaabaabaaabaaaaabaaaabbbbbbbaaaabaabbbababbaaaabbabababbbabbbbabbabaabaaabbabbaaababaaabaaaabababbbbbbbaabbaaabbabbbbbabbbaaaaababbbaaabaabababbabbabababbabbabaaaaabaaaaaabbbabaabbbaaaabbabababaaababaabbbbbbbaaabbbabaabaaaabaabaababbaaaabababaabbbaaaababaaababbbbbbabbbbbbaabbabbaaa...

output:

43524

result:

ok single line: '43524'

Test #18:

score: 25
Accepted
time: 109ms
memory: 206912kb

input:

baaaabbbabbbbabbbbabbbabbbbbabbbabbaabbbbbbabbabaabbbbbbbbbbbbaabbbbbaaabaaabbbbbaabbbbbbbbbbbbbababbbbabbbbbbbbbbbbbbbbabbbbbbbbabbbbabbbbaabaabbbabbbabbbaabbbbbabbbbbbaaabbbbbbaaabbaaabbabbabbbbbaabbbbbabbabababbbbbbbbbbbbabbbbaabbbbabbbbbbbbbbbbbbbabbbbbabbabbabababbbabbbbaabbabbbbbbbbaabbaabbbbb...

output:

107148

result:

ok single line: '107148'

Test #19:

score: 25
Accepted
time: 115ms
memory: 236236kb

input:

bbbbbabbbbbabbbbbbbbbbbbbbbbbbaaabbbbbbabbbbbbbaababbbbbbbbbbbabbbbbababbaabbbbbbbbbbbbbbbbbbabbbbabbbbbbbbaabbbbabbbbbbbbaabbbbbbbbbbbbbbbbbbbbbbabbbbbbaaabbabbbbbbabbbbbbabbbabbabbbbabbbbbbbbbbbbbabbbbbabbbbbbbbbbbbababbbbbbbbbbababbbabbabbbabbbabbabbbbabbababbbbbbbbbbbbbababbbbbabbbabbbbabbbbbbab...

output:

84043

result:

ok single line: '84043'

Test #20:

score: 25
Accepted
time: 102ms
memory: 229776kb

input:

baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

3

result:

ok single line: '3'

Test #21:

score: 25
Accepted
time: 97ms
memory: 235884kb

input:

bbbbbbbbbbbbbbbbabbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbabbabbbbbbbbbbbbbbbbbb...

output:

142965

result:

ok single line: '142965'

Test #22:

score: 25
Accepted
time: 109ms
memory: 230064kb

input:

baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

5

result:

ok single line: '5'

Test #23:

score: 25
Accepted
time: 99ms
memory: 235524kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

99972

result:

ok single line: '99972'

Test #24:

score: 25
Accepted
time: 70ms
memory: 190204kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

99997

result:

ok single line: '99997'

Test #25:

score: 25
Accepted
time: 86ms
memory: 225348kb

input:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

99999

result:

ok single line: '99999'

Test #26:

score: 25
Accepted
time: 85ms
memory: 233372kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

130005

result:

ok single line: '130005'

Test #27:

score: 25
Accepted
time: 86ms
memory: 182756kb

input:

baabbaabaaabbaaaababaabbaabbabaabaaaabaaaaababaaabaabbbbaabbaabaaaabaabaaaaabaabbabaaaaabbaaabaaababbbbbabbbbbbbbabbbbbbbbabbaaabaabaaaabaaaabbbbbaaabaaaaaaabaaabbbaaabbbbbaaabbaaaababaabbbbaabaaabbbbaababaaabaaabbababbbababbabaaaaabaaababbaaabbbabababaababaabbababaaaabbababaababbbbbbaabbaabababbaab...

output:

67291

result:

ok single line: '67291'

Test #28:

score: 25
Accepted
time: 93ms
memory: 227772kb

input:

baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

3

result:

ok single line: '3'

Subtask #5:

score: 25
Accepted

Dependency #1:

100%
Accepted

Dependency #4:

100%
Accepted

Test #29:

score: 25
Accepted
time: 241ms
memory: 314284kb

input:

aabbbaaaaaaaababaabaaaabbbbabababbaaaaaabaabbabbbaaabbaaabbaaaabbabaabaaababbbaaaabbababbabbaabbbbaabaaabbaabababaaaabbbbbabbbaaaaaabbbbabbaaababbaaabaaaabaaaaaaabbbaababaabababaabbabaababababaabbaabaaabababbbbabbbaaabbbbaabaaaabaaaaaababbababbaabbabaababbababbabbbbabbaabbabbbbbbbbaabaabbbbbbbbbbbba...

output:

72979

result:

ok single line: '72979'

Test #30:

score: 25
Accepted
time: 329ms
memory: 393480kb

input:

fefddeecdbffabadeeccbafdcfcabfacbfdbadccbcaebecdfeaaaebaacddcbacefacfcfdccfcecaabaebaeebeadddcfbaecdcaeebfbdeaecfdabcbdeabecbdbcdcdebedaaffacffbbedacefbffecfffebeebbfadabbfcafdbcedadbcddfbdedabbdafcacbafaeccaabbbbffceaebeebeeaffbdbfdceffdcdfdefdbedfdcddacefeafbcbaedbfefbaddeaecbcbfdaaacfdabeeacaaeea...

output:

68728

result:

ok single line: '68728'

Test #31:

score: 25
Accepted
time: 264ms
memory: 372976kb

input:

agahaiaaafagaeagagadajaaaeagagaiacacaeagaeafajajajajacafahaiagaeabaiaiaaagadaeabahacadafajagajahafacaaafadaiahahajajajaeagabahahahaeaaacahahaaafagababaeaeacagaiabacagaaaaaaafadaaajadafacagaaajaiahaiaaacabajaiagaiagacahadabahaaaeaeababadadaaaeaeacaeadaiaeaeagagadaaaiadabaiagaaaaaiajahahagacaeahahahaa...

output:

272423

result:

ok single line: '272423'

Test #32:

score: 25
Accepted
time: 176ms
memory: 307296kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

250000

result:

ok single line: '250000'

Test #33:

score: 25
Accepted
time: 201ms
memory: 386268kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

249976

result:

ok single line: '249976'

Test #34:

score: 25
Accepted
time: 225ms
memory: 316004kb

input:

abbabababbbaaabbbabbabaaababbabbabbaabbbaabaababbbbaabaabaaabbbbbbaabbbabbbbbabababbbbaababbbbaabaaaaabbbbbbbabbbbabaabaaaababbaabaaaabbbaabbbabbbbaaaaaabbaaaaababbaaabaaaabbaabaabbbabababbababbbbababaaaabbabbbbbbbbbbaaaababababababababaababbbaabbbbbabbbbabbbbbababbabbabbaaaabaaabbababaaabbbabbbbbbb...

output:

106249

result:

ok single line: '106249'

Test #35:

score: 25
Accepted
time: 251ms
memory: 316312kb

input:

abaaabbabbbabbaabbbbbbbabbaababbbabbaabbabaabbabbbbabaababbbbaaaaabbbbbbababbbaabaababaabbbaaababaaaaaaaabaaabaaaaaabaaabbbbabbabbaaabbaabbabbbaabbbbaaabaaaabbaabababbaaabbaaaabbabbbbaabbaaabaaaabbbaabbabbbbaababaabaaaaabbbabbbbababaaabbaabababbaababbabbbbbbabaaaabbbbbaaababbbaaaababaaaaaababaababba...

output:

175546

result:

ok single line: '175546'

Test #36:

score: 25
Accepted
time: 298ms
memory: 348052kb

input:

zksvttiyllprjwwcbhfjhdixsaxlgmolhwqrenaqnhuupvjlloduecabbumzrblxlhrmbiiwsfuyqnxpkqyesjtvvhdxmakdkenackoorbdsaaauhdnyjtpvunfnhjxgexufgcmlofvybcaoaisoofrgcypcaaxtbvwhlkilgryxblkpnprmpnjekybsnwngnudeohozwjdgwnifuxogrkszgjebmanxcvbjfpetcnytapxkmqdoivsqzpfxhckmsosohwtcvdubnfjyydagtarffsmnmjszjyskysyrudrl...

output:

12409

result:

ok single line: '12409'

Test #37:

score: 25
Accepted
time: 281ms
memory: 351988kb

input:

ifcjrrilczgpvwvcryxjygnifpgmkvpzqqapttabzfzcgooybkcnfwtqmjynftxlbqqtsnwcmdrfvpvxhppqwvipewfabeyplslxlplhkrvtyqejmrrwrfxpxwnqynafskbrulumilnsvtnwfmzlvwcmtlsnsidgqwknknlpwpvdurazgajldygvijqpdmkjuygdbhduzopepwbovtggvpvegyhdlenyglmrpdfaolqiseowiqeqsbtuedprcezazmyrtudwpilozezxipedcyfnykueyvgghfpzzlcqsues...

output:

3103

result:

ok single line: '3103'

Test #38:

score: 25
Accepted
time: 299ms
memory: 391828kb

input:

bcbefabbbbacdcfccfedddffbdaddbbdfcdbcbaffdcccbdecddbcfdcffbdeafcaffbebfbcaecaceacadafbcedddabfcdeeffeeebeafccfbdebeccbcdbeaebbfeabedecfdfdadafabbadbddffdbabddacebdcbdefbddebeaaceeceedeecddbbcbfcabbaebcceddcedfaababecdbbebadcfaeacfcdaefeeacebcbdeaadaafffebdcaabadebdbebacfecddccdbddffaeafbdaeefaafbcbb...

output:

59712

result:

ok single line: '59712'

Test #39:

score: 25
Accepted
time: 308ms
memory: 389152kb

input:

dfdbdbacddfcbadafcadaabaafcfbfebcaabefecfbbddceccddacefbadfdcefbcbecdbfceaccdaaaefcfdfefecfaecebacfcccbcaeffccbaceaeddcfadaddadbeedbbbfabbefbaddecefaeadcceabeedfeedaedfdbcacecddacedfeecfbcebfbbccecaccaaadeeeebeebeefaeacdafcedbeaccbfcacaefdcddeaeefdabfccadbfbcbeceedddaeaddffdfddafacdfacfeaffdadcbbded...

output:

59161

result:

ok single line: '59161'

Test #40:

score: 25
Accepted
time: 187ms
memory: 402396kb

input:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

249976

result:

ok single line: '249976'

Test #41:

score: 25
Accepted
time: 176ms
memory: 307648kb

input:

baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1

result:

ok single line: '1'

Test #42:

score: 25
Accepted
time: 217ms
memory: 315668kb

input:

abbabababbbaaabbbabbabaaababbabbabbaabbbaabaababbbbaabaabaaabbbbbbaabbbabbbbbabababbbbaababbbbaabaaaaabbbbbbbabbbbabaabaaaababbaabaaaabbbaabbbabbbbaaaaaabbaaaaababbaaabaaaabbaabaabbbabababbababbbbababaaaabbabbbbbbbbbbaaaababababababababaababbbaabbbbbabbbbabbbbbababbabbabbaaaabaaabbababaaabbbabbbbbbb...

output:

106249

result:

ok single line: '106249'

Test #43:

score: 25
Accepted
time: 170ms
memory: 393232kb

input:

baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

71

result:

ok single line: '71'

Test #44:

score: 25
Accepted
time: 173ms
memory: 375076kb

input:

caaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

75

result:

ok single line: '75'

Test #45:

score: 25
Accepted
time: 159ms
memory: 338972kb

input:

baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

2

result:

ok single line: '2'

Subtask #6:

score: 0
Skipped

Dependency #2:

0%