QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#555992 | #8223. 字符串游戏 | 275307894a | 100 ✓ | 812ms | 511760kb | C++14 | 2.5kb | 2024-09-10 13:36:45 | 2024-09-10 13:36:46 |
Judging History
answer
#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
#define all(x) x.begin(),x.end()
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=2e6+5,M=N*20+5,K=1e7+5,mod=998244353,Mod=mod-1;const db eps=1e-9;const ll INF=1e13+7;mt19937 rnd(263082);
#define Tp template<typename T>
#define Ts template<typename T,typename... Ar>
namespace Debug{
Tp void _debug(char* f,T t){cerr<<f<<'='<<t<<endl;}
Ts void _debug(char* f,T x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
#ifdef LOCAL
#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
#else
#define gdb(...) void()
#endif
}using namespace Debug;
vector<int> S[N];
namespace SAM{
int cnt=1,La=1,son[N][26],link[N],len[N];
void extend(char c){
len[++cnt]=len[La]+1;int p=La;La=cnt;
while(p&&!son[p][c]) son[p][c]=La,p=link[p];
if(!p){link[La]=1;return;}
int q=son[p][c];
if(len[q]==len[p]+1){link[La]=q;return;}
len[++cnt]=len[p]+1;link[cnt]=link[q];link[q]=link[La]=cnt;Mc(son[cnt],son[q]);
while(p&&son[p][c]==q) son[p][c]=cnt,p=link[p];
}
void build(){
for(int i=2;i<=cnt;i++) S[link[i]].push_back(i);
}
}
char s[N];
int n,pl[N];
int bg[N],en[N],bh,fa[N][22];
void make(int x,int La){
fa[x][0]=La;bg[x]=++bh;
for(int i=1;fa[x][i-1];i++) fa[x][i]=fa[fa[x][i-1]][i-1];
for(int i:S[x]) make(i,x);
en[x]=bh;
}
int st[N],sh;
namespace bit{
int f[N];
void add(int x){while(x<=bh) f[x]++,x+=x&-x;}
int qry(int x){int ans=0;while(x) ans+=f[x],x-=x&-x;return ans;}
}
void add(int x){
bit::add(bg[pl[x]]);
}
int qry(int x,int y){
x=y-x+1;y=pl[y];
for(int i=21;~i;i--) if(SAM::len[fa[y][i]]>=x) y=fa[y][i];
return bit::qry(en[y])-bit::qry(bg[y]-1);
}
int f[N];
void Solve(){
scanf("%s",s+1);n=strlen(s+1);
reverse(s+1,s+n+1);
for(int i=1;i<=n;i++) SAM::extend(s[i]-'a'),pl[i]=SAM::La;
SAM::build();
make(1,0);
for(int i=1;i<=n;i++){
f[i]=1;
add(i);
while(sh){
f[i]=max(f[i],qry(st[sh]+1,i)-f[st[sh]]);
if(f[i]<=f[st[sh]]) sh--;
else break;
}
st[++sh]=i;
gdb(f[i]);
}
printf("%d\n",f[n]);
}
int main(){
int t=1;
// scanf("%d",&t);
while(t--) Solve();
cerr<<clock()*1.0/CLOCKS_PER_SEC<<'\n';
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 12ms
memory: 63040kb
input:
abbabbbbabbaaaaabbbaabaaaaaabbbaabbabababaabababaababaaaaaabaaabaaabbbbababaaabbbabababbbabbbaabaaababbbaabaabbaaabbababaaaaabbbaabaaabbaabaabaaabaaabaababaabbbbbbbbabbbbbabbbaabababbaababbbbbabbbbaaabbaabaabaaabbabbaaabbaaababaabbbaabbbaaaabbababbabaababababaaaabbaaaabaabaaaababaaabababbbaaabababbb...
output:
1281
result:
ok single line: '1281'
Test #2:
score: 10
Accepted
time: 8ms
memory: 63292kb
input:
aaaabababbabbbbbabbbbbbbbbbbabbbbbabbbaaabbbbaababaabbbbbbbbbbbbbabaabbaaabaababaabaaabbabbbabbbabaabbaabaababbbbbbaaabbbbaaabaabbbabbbabbabaabbbbabbbaabaaaabbbbbabaaaabaabbabaaabbaabbabbaaabbabaaababbababababaabaaaabaabaabaaabaabbbabbbbbaababbabbbabbbbababaaabbabbaaaabbbaaabaabbbaaaaaababaababbbbba...
output:
1483
result:
ok single line: '1483'
Test #3:
score: 10
Accepted
time: 4ms
memory: 69764kb
input:
bbaaababbbabbbaabbbbbbababbbabbbbbbbbaabbbbbbbbbbaaabbbbbbbbbbbbbbbabbabbbabaababbbabbbbabbabbabbbbabbbbbbbbbaaababbaaabbbaabbabbbbbbbbbbbbbbbbbbbbabbbbbbababababbbbbbbbbabababaabbbbbbabbbbaabbababbaaababbbbabbbbabbbabbbbbabbbbbabbbbbbbbbbabbaabbbabababbbbaababbbababbbbabbabbaabbbbbbabbbbbababbbbaba...
output:
2310
result:
ok single line: '2310'
Test #4:
score: 10
Accepted
time: 7ms
memory: 63156kb
input:
abbbbbbbbababbbbbbbbbabbbbbbbbabbbabbbbbaaabbbbbabbbbababbbabbbbbbaabbabbbbbaabbbbabbabbbbbbbabbbbaaabbbbbbaabbbbbbbbbbbbbbbbbbbbbabbbabbbabbbbbbbabbbbbbbabbbabbbbbbbbabbbabbbbbbbbbbbbbbbbbaababbbbbbbbbbabbbbbbbbbbbbbababbbbbbbabbbbbbababbbabbbbbaabbbbbbbbbaabbabbbbaabbbabbbbbbbbbbbbbabbbbbbbbbbbbbb...
output:
1
result:
ok single line: '1'
Test #5:
score: 10
Accepted
time: 7ms
memory: 64364kb
input:
bbbabbbbbbbbbbbbbbbbbbbbabbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbabbbabbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbabbbbbbbbbabbbbabbabbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbabbbbbbbbbbbabbbbbbbbbbbbbbbbbbbabbbbbbabbabbbbbbaabbbabbbbbbbbbbbbbbbbabbbbbabbbabbbbbbbabbbababbabbbbba...
output:
3680
result:
ok single line: '3680'
Test #6:
score: 10
Accepted
time: 3ms
memory: 63672kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbb...
output:
2454
result:
ok single line: '2454'
Test #7:
score: 10
Accepted
time: 3ms
memory: 63188kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
2702
result:
ok single line: '2702'
Test #8:
score: 10
Accepted
time: 4ms
memory: 63996kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
2499
result:
ok single line: '2499'
Test #9:
score: 10
Accepted
time: 11ms
memory: 63204kb
input:
amahaaajakalaiacabararasafaxasagamajaqagaqaeauauayagasadazavaeagabaaajalajavalatauapacaearaeagafawaaapawadaiaaapalahanavazasayamaiafagabahaxanacaaagaoadasakayagawaiaharanamaraiaramazaoagajataoazasalavatafaoalacaqavanafatajawauayakaoaqawawayasatasazagafacayasasawaqayadasaiazaxamaaaragataxawazadalaxak...
output:
2475
result:
ok single line: '2475'
Test #10:
score: 10
Accepted
time: 7ms
memory: 63056kb
input:
afabagadaeaeacaeaeafagafagababaaagacabaaagadacafadabaaaaacadaaagafacagadaeacacacabadagadaaabafadafadadaeafaaagadafabaeaaafaeaeaaaeabaaabaaaeafagadaaaaacaeaaaaacabaeacadagafafacacabaeaaagagaeaaadagabadaaaaagafagaaabaaaaafacafacadaaagabaaafadagacaaafafadadadacadadaaacagabacaaabacaeadabacagaeagagafafag...
output:
2807
result:
ok single line: '2807'
Subtask #2:
score: 10
Accepted
Test #11:
score: 10
Accepted
time: 812ms
memory: 509748kb
input:
aaaaaaabbaaabbbbabbabbbababaabaaabaabbaaababaaaaaabbbbbaabbbabbbaabbabaababaababaabbbababbbabaaaaaaaaabaaaaabbbabbbbbabaaabaaaababbabbbbbbaabbbbbaababbbbababbbbbbbbbbbaaabbabbaababbaaaabbabaaabbaaabbbbaaababbbbbabbaababbaaababaaabbabaabbbbabbaaabbababbaabbaaaaaaaaaabababbbaaaababbabbbabbababbabbabbb...
output:
234567
result:
ok single line: '234567'
Test #12:
score: 10
Accepted
time: 744ms
memory: 511760kb
input:
aababbbbaaabaabababbbaabbabbaabbaababaabaabaabbbaaaabbabbbbbaaaaabbbaabbbaaaaaaaabbbabaabbbaabaaabaabbabbabbbaaabbbbbaabaabaaaaabbbabbaaaababbaaababbbbaaabaabbababbbbbaaabbaabaaaaaaabbbbbaabbaaabaababababbbbabbbbaabbababbbbbaabbabaaaaabbabbbabbaaaababababbbabaabababaaabbbbaaabbabababaabaabaaabbabaab...
output:
198433
result:
ok single line: '198433'
Test #13:
score: 10
Accepted
time: 785ms
memory: 509416kb
input:
bababbbabaaabbbaabaabaababbbaabaabaaaaaabaaaaaaaabaaabbabbaaaaababbbbbbababaabbaabbabaabaaabaaaabbbbbaaabbababbabbbabbbaaaabbbbaaabbaabbbababbbabbbbabbbbabbbbabaaaabaaaabababbaaabbaaabbaabbbbbababababbbbbbbbabaaabaaaaaaabbbabbabbbaaabbbabbababaabababaabbabbbabaaabbaabbabbbababaababaaabaabababaababbb...
output:
248857
result:
ok single line: '248857'
Test #14:
score: 10
Accepted
time: 769ms
memory: 507848kb
input:
aabababababbaaaababbaabbabaaaaaababbaabaaabbaaaaabaaabbaababbbaaaabbbaabbabbaaaabaaabbbaaaababbbbaabaabbaabaaaaaabababaabbaaabbbaaabbabababaabaaaababaaaaabbbbabbaabbbababbbbaaaaabbbabaabbbaababaabbaaababbaabababbabaaabbbabbbbabaaabaaabbbaabbbaabbbabbbbabaaabbabababbbbabababbbbbbaaababaababaabaabbbbb...
output:
257032
result:
ok single line: '257032'
Test #15:
score: 10
Accepted
time: 750ms
memory: 507532kb
input:
bbbababbaaabbaababaaababaaaababababbbbbabaaaaaabbbbbabbabbaaabaaabababbbabbbaaaaaaaaabbaaaababbbaabaaabbaaabbabbabaabbabbbaabbabaabbbbaaabbbaaabbabbbabbabbbbaabaababaaabbbbabbbbbaaaaaaabbabbbbbabbabbbbaaabbaabbbaabbbbaabbbbbbbababaabaaaabbababaaaaabbabaaabaabbaabbbaaabbbbbbaabababbbbbababbbaabbbabaa...
output:
222902
result:
ok single line: '222902'
Subtask #3:
score: 5
Accepted
Test #16:
score: 5
Accepted
time: 293ms
memory: 357004kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
493827
result:
ok single line: '493827'
Subtask #4:
score: 25
Accepted
Test #17:
score: 25
Accepted
time: 91ms
memory: 130668kb
input:
bbbbbbbbbaabbbbbabaaabaabaaabaaaaabaaaabbbbbbbaaaabaabbbababbaaaabbabababbbabbbbabbabaabaaabbabbaaababaaabaaaabababbbbbbbaabbaaabbabbbbbabbbaaaaababbbaaabaabababbabbabababbabbabaaaaabaaaaaabbbabaabbbaaaabbabababaaababaabbbbbbbaaabbbabaabaaaabaabaababbaaaabababaabbbaaaababaaababbbbbbabbbbbbaabbabbaaa...
output:
43524
result:
ok single line: '43524'
Test #18:
score: 25
Accepted
time: 113ms
memory: 143700kb
input:
baaaabbbabbbbabbbbabbbabbbbbabbbabbaabbbbbbabbabaabbbbbbbbbbbbaabbbbbaaabaaabbbbbaabbbbbbbbbbbbbababbbbabbbbbbbbbbbbbbbbabbbbbbbbabbbbabbbbaabaabbbabbbabbbaabbbbbabbbbbbaaabbbbbbaaabbaaabbabbabbbbbaabbbbbabbabababbbbbbbbbbbbabbbbaabbbbabbbbbbbbbbbbbbbabbbbbabbabbabababbbabbbbaabbabbbbbbbbaabbaabbbbb...
output:
107148
result:
ok single line: '107148'
Test #19:
score: 25
Accepted
time: 102ms
memory: 160604kb
input:
bbbbbabbbbbabbbbbbbbbbbbbbbbbbaaabbbbbbabbbbbbbaababbbbbbbbbbbabbbbbababbaabbbbbbbbbbbbbbbbbbabbbbabbbbbbbbaabbbbabbbbbbbbaabbbbbbbbbbbbbbbbbbbbbbabbbbbbaaabbabbbbbbabbbbbbabbbabbabbbbabbbbbbbbbbbbbabbbbbabbbbbbbbbbbbababbbbbbbbbbababbbabbabbbabbbabbabbbbabbababbbbbbbbbbbbbababbbbbabbbabbbbabbbbbbab...
output:
84043
result:
ok single line: '84043'
Test #20:
score: 25
Accepted
time: 104ms
memory: 151684kb
input:
baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
3
result:
ok single line: '3'
Test #21:
score: 25
Accepted
time: 98ms
memory: 154728kb
input:
bbbbbbbbbbbbbbbbabbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbabbabbbbbbbbbbbbbbbbbb...
output:
142965
result:
ok single line: '142965'
Test #22:
score: 25
Accepted
time: 83ms
memory: 156344kb
input:
baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
5
result:
ok single line: '5'
Test #23:
score: 25
Accepted
time: 86ms
memory: 156148kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
99972
result:
ok single line: '99972'
Test #24:
score: 25
Accepted
time: 63ms
memory: 133148kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
99997
result:
ok single line: '99997'
Test #25:
score: 25
Accepted
time: 74ms
memory: 153392kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
99999
result:
ok single line: '99999'
Test #26:
score: 25
Accepted
time: 78ms
memory: 161048kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
130005
result:
ok single line: '130005'
Test #27:
score: 25
Accepted
time: 83ms
memory: 126244kb
input:
baabbaabaaabbaaaababaabbaabbabaabaaaabaaaaababaaabaabbbbaabbaabaaaabaabaaaaabaabbabaaaaabbaaabaaababbbbbabbbbbbbbabbbbbbbbabbaaabaabaaaabaaaabbbbbaaabaaaaaaabaaabbbaaabbbbbaaabbaaaababaabbbbaabaaabbbbaababaaabaaabbababbbababbabaaaaabaaababbaaabbbabababaababaabbababaaaabbababaababbbbbbaabbaabababbaab...
output:
67291
result:
ok single line: '67291'
Test #28:
score: 25
Accepted
time: 108ms
memory: 155544kb
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: 260ms
memory: 204716kb
input:
aabbbaaaaaaaababaabaaaabbbbabababbaaaaaabaabbabbbaaabbaaabbaaaabbabaabaaababbbaaaabbababbabbaabbbbaabaaabbaabababaaaabbbbbabbbaaaaaabbbbabbaaababbaaabaaaabaaaaaaabbbaababaabababaabbabaababababaabbaabaaabababbbbabbbaaabbbbaabaaaabaaaaaababbababbaabbabaababbababbabbbbabbaabbabbbbbbbbaabaabbbbbbbbbbbba...
output:
72979
result:
ok single line: '72979'
Test #30:
score: 25
Accepted
time: 322ms
memory: 234072kb
input:
fefddeecdbffabadeeccbafdcfcabfacbfdbadccbcaebecdfeaaaebaacddcbacefacfcfdccfcecaabaebaeebeadddcfbaecdcaeebfbdeaecfdabcbdeabecbdbcdcdebedaaffacffbbedacefbffecfffebeebbfadabbfcafdbcedadbcddfbdedabbdafcacbafaeccaabbbbffceaebeebeeaffbdbfdceffdcdfdefdbedfdcddacefeafbcbaedbfefbaddeaecbcbfdaaacfdabeeacaaeea...
output:
68728
result:
ok single line: '68728'
Test #31:
score: 25
Accepted
time: 255ms
memory: 230272kb
input:
agahaiaaafagaeagagadajaaaeagagaiacacaeagaeafajajajajacafahaiagaeabaiaiaaagadaeabahacadafajagajahafacaaafadaiahahajajajaeagabahahahaeaaacahahaaafagababaeaeacagaiabacagaaaaaaafadaaajadafacagaaajaiahaiaaacabajaiagaiagacahadabahaaaeaeababadadaaaeaeacaeadaiaeaeagagadaaaiadabaiagaaaaaiajahahagacaeahahahaa...
output:
272423
result:
ok single line: '272423'
Test #32:
score: 25
Accepted
time: 130ms
memory: 217880kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
250000
result:
ok single line: '250000'
Test #33:
score: 25
Accepted
time: 163ms
memory: 237892kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
249976
result:
ok single line: '249976'
Test #34:
score: 25
Accepted
time: 255ms
memory: 202992kb
input:
abbabababbbaaabbbabbabaaababbabbabbaabbbaabaababbbbaabaabaaabbbbbbaabbbabbbbbabababbbbaababbbbaabaaaaabbbbbbbabbbbabaabaaaababbaabaaaabbbaabbbabbbbaaaaaabbaaaaababbaaabaaaabbaabaabbbabababbababbbbababaaaabbabbbbbbbbbbaaaababababababababaababbbaabbbbbabbbbabbbbbababbabbabbaaaabaaabbababaaabbbabbbbbbb...
output:
106249
result:
ok single line: '106249'
Test #35:
score: 25
Accepted
time: 255ms
memory: 201500kb
input:
abaaabbabbbabbaabbbbbbbabbaababbbabbaabbabaabbabbbbabaababbbbaaaaabbbbbbababbbaabaababaabbbaaababaaaaaaaabaaabaaaaaabaaabbbbabbabbaaabbaabbabbbaabbbbaaabaaaabbaabababbaaabbaaaabbabbbbaabbaaabaaaabbbaabbabbbbaababaabaaaaabbbabbbbababaaabbaabababbaababbabbbbbbabaaaabbbbbaaababbbaaaababaaaaaababaababba...
output:
175546
result:
ok single line: '175546'
Test #36:
score: 25
Accepted
time: 282ms
memory: 215272kb
input:
zksvttiyllprjwwcbhfjhdixsaxlgmolhwqrenaqnhuupvjlloduecabbumzrblxlhrmbiiwsfuyqnxpkqyesjtvvhdxmakdkenackoorbdsaaauhdnyjtpvunfnhjxgexufgcmlofvybcaoaisoofrgcypcaaxtbvwhlkilgryxblkpnprmpnjekybsnwngnudeohozwjdgwnifuxogrkszgjebmanxcvbjfpetcnytapxkmqdoivsqzpfxhckmsosohwtcvdubnfjyydagtarffsmnmjszjyskysyrudrl...
output:
12409
result:
ok single line: '12409'
Test #37:
score: 25
Accepted
time: 288ms
memory: 216196kb
input:
ifcjrrilczgpvwvcryxjygnifpgmkvpzqqapttabzfzcgooybkcnfwtqmjynftxlbqqtsnwcmdrfvpvxhppqwvipewfabeyplslxlplhkrvtyqejmrrwrfxpxwnqynafskbrulumilnsvtnwfmzlvwcmtlsnsidgqwknknlpwpvdurazgajldygvijqpdmkjuygdbhduzopepwbovtggvpvegyhdlenyglmrpdfaolqiseowiqeqsbtuedprcezazmyrtudwpilozezxipedcyfnykueyvgghfpzzlcqsues...
output:
3103
result:
ok single line: '3103'
Test #38:
score: 25
Accepted
time: 298ms
memory: 233280kb
input:
bcbefabbbbacdcfccfedddffbdaddbbdfcdbcbaffdcccbdecddbcfdcffbdeafcaffbebfbcaecaceacadafbcedddabfcdeeffeeebeafccfbdebeccbcdbeaebbfeabedecfdfdadafabbadbddffdbabddacebdcbdefbddebeaaceeceedeecddbbcbfcabbaebcceddcedfaababecdbbebadcfaeacfcdaefeeacebcbdeaadaafffebdcaabadebdbebacfecddccdbddffaeafbdaeefaafbcbb...
output:
59712
result:
ok single line: '59712'
Test #39:
score: 25
Accepted
time: 315ms
memory: 234116kb
input:
dfdbdbacddfcbadafcadaabaafcfbfebcaabefecfbbddceccddacefbadfdcefbcbecdbfceaccdaaaefcfdfefecfaecebacfcccbcaeffccbaceaeddcfadaddadbeedbbbfabbefbaddecefaeadcceabeedfeedaedfdbcacecddacedfeecfbcebfbbccecaccaaadeeeebeebeefaeacdafcedbeaccbfcacaefdcddeaeefdabfccadbfbcbeceedddaeaddffdfddafacdfacfeaffdadcbbded...
output:
59161
result:
ok single line: '59161'
Test #40:
score: 25
Accepted
time: 201ms
memory: 241720kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
249976
result:
ok single line: '249976'
Test #41:
score: 25
Accepted
time: 159ms
memory: 217600kb
input:
baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
1
result:
ok single line: '1'
Test #42:
score: 25
Accepted
time: 252ms
memory: 203112kb
input:
abbabababbbaaabbbabbabaaababbabbabbaabbbaabaababbbbaabaabaaabbbbbbaabbbabbbbbabababbbbaababbbbaabaaaaabbbbbbbabbbbabaabaaaababbaabaaaabbbaabbbabbbbaaaaaabbaaaaababbaaabaaaabbaabaabbbabababbababbbbababaaaabbabbbbbbbbbbaaaababababababababaababbbaabbbbbabbbbabbbbbababbabbabbaaaabaaabbababaaabbbabbbbbbb...
output:
106249
result:
ok single line: '106249'
Test #43:
score: 25
Accepted
time: 199ms
memory: 236632kb
input:
baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
71
result:
ok single line: '71'
Test #44:
score: 25
Accepted
time: 189ms
memory: 232076kb
input:
caaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
75
result:
ok single line: '75'
Test #45:
score: 25
Accepted
time: 163ms
memory: 207432kb
input:
baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
2
result:
ok single line: '2'
Subtask #6:
score: 25
Accepted
Dependency #2:
100%
Accepted
Dependency #3:
100%
Accepted
Dependency #5:
100%
Accepted
Test #46:
score: 25
Accepted
time: 636ms
memory: 361216kb
input:
mwwbxfwwayliqflnawfefkmgmwtweyrxobkdiqdleenlncchjgdoonpyekqpklctjirybsftrlewxuyvelkmnprdsdfvzkhatjmamulwfqesxsqjhzoyxceyruxkrpucqcpbqetdnjfslcwdiglgryodhvcwiqrfcrkpvriwdnqkbrdxrqlhjhlhdjlbyhqdnwdsrafqgqpjhtrtkfuetacyzzuitfjstjgiulyxaoneeyspxjyfbvbbqfobidicseztwlwamagvduizgmyscfdumgafhjlbcnmwvtpjkgiz...
output:
3427
result:
ok single line: '3427'
Test #47:
score: 25
Accepted
time: 633ms
memory: 364296kb
input:
jpqxtaollqqmqvnxrznvviaaobvcnzizszcocelshqopokjbydrvsbewxhrqroqlewprxqdmmgetmanzdvmhoosjjypulwqddgsftctcwrfjgzhmsjsnjgizpczenspgmvfqbfxobzlndgveuvbitvrtfofjkexejnxsdmuoydyitdakindsmhjvxcukiwsvlkhjvzomdfcujnlaarlsocbsldjrcoicisxkttaspqhjxayjtvpgberegzscqhtxehkzpxeewpvhskfgmnadspyjdwrpjybztnhxplrwaqwo...
output:
31255
result:
ok single line: '31255'
Test #48:
score: 25
Accepted
time: 580ms
memory: 327404kb
input:
bbabbbaaabbbabaaaabababbabbbbbabbbbbbbbbbbabbbbbabbbaaabbbbaababaabbbbbbbbbbbbbabaabbaaabaababaabaaabbabbbabbbabaabbaabaababbbbbbaaabbbbaaabaabbbabbbabbabaabbbbabbbaabaaaabbbbbabaaaabaabbabaaabbaabbabbaaabbabaaababbababababaabaaaabaabaabaaabaabbbabbbbbaababbabbbabbbbababaaabbabbaaaabbbaaabaabbbaaaaa...
output:
295499
result:
ok single line: '295499'
Test #49:
score: 25
Accepted
time: 570ms
memory: 326584kb
input:
bbaababaaabababbbabbbbbabaaaababababbaababbaaabbabbbababaaaababbbbabbbababbaaaababbbaabaababbabbbaaaabbabbbabbaaaababababaabbbbbbaaababaabaaababaabababbbababbbbabbabaabaaabaaabaaababababaaabbbaaaaabaabbbbbbbababbabababbaabaababaabbbbaaababaabbaaabaabaabbbbaaabababbbaabaaabaaaabaaaaaabaaabaaaabbaaaab...
output:
142897
result:
ok single line: '142897'
Test #50:
score: 25
Accepted
time: 342ms
memory: 360548kb
input:
baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
1
result:
ok single line: '1'
Test #51:
score: 25
Accepted
time: 567ms
memory: 325672kb
input:
bbaaabaabababaaababbababaabbaaaabbabbbaabaaabaabaaaabbababbbaaabbaaaabaaabaaabbbabbbbabbaaaaababbbaabbabababaabbabbabbabbaaabbbaababaaabbabbaababaabaaabbbaababbbaaabbaaabbaabaabbababbaababbbbbaabaabababababaaaaabbbbabbabbbbabbbbabbbbabaabbbaabbabbaaaabbabaaabbbababbbaaabaaabbaaabaaabbbaabaaaabaabbaa...
output:
204172
result:
ok single line: '204172'
Test #52:
score: 25
Accepted
time: 785ms
memory: 402860kb
input:
eafebaefcabeaadaeeacecdfdfababaeadfbdaabcfccafcafacfbbdaebaddffaedbadafbbbfafcfbbceeccccbeddaefcddaaacaaaebdefdafadaacdaaebeaefbfaccfdbfaabfffafecacdedfabadafababedabcaabfaedefabfbccafccbacccafcdddaafaeddedadedbbbbfeefcbdabeaefaebeddeebaedadfcacaebcdccaeaeaaaacdcbfbeeeaeddeaaddacdcbfebaddbffddfaabca...
output:
21449
result:
ok single line: '21449'
Test #53:
score: 25
Accepted
time: 762ms
memory: 403604kb
input:
dbddbcffaeeecbdbcbccebcfdcbfeefbfbeffabfcedccbadadeecfbeefabdbacfefaebfbbcbbbeefffaacfeedffbbcfadecaefcddacfbfcbbddeeabeddccbfcaadcdeeaccfafaacaccdebdfcdbdafddcdbfbacfccfdfcedbfdecfebabaaadeddeeacbbbffafabcfceebcbdfaffbcbabdedfefbeddfedbceaedeabaedfecfbbbcaefdcadcceaeafeefaceabfcbadfdaaaaecfffefaaac...
output:
67202
result:
ok single line: '67202'
Test #54:
score: 25
Accepted
time: 373ms
memory: 404180kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
500000
result:
ok single line: '500000'
Test #55:
score: 25
Accepted
time: 413ms
memory: 418328kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
499954
result:
ok single line: '499954'
Test #56:
score: 25
Accepted
time: 599ms
memory: 356388kb
input:
ayaxaiakaeasaiacawakadaqacaqaoauakaeaqazaaamajabazauaradagalanahajaoahadadataqauawasawapabanaaapajahajadabalacadafadaaacaoadajaraqaaaaacaoaxaxajaeakafadapalacahayazadawakamaaafahacavatazacaoasacararacatamaralazaaadajavamamaxacarakauaoarayalakakalaqabafapaxavaaabafabaiajauaoanatarayaoakanaqalayataoap...
output:
500603
result:
ok single line: '500603'
Test #57:
score: 25
Accepted
time: 401ms
memory: 398832kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
499950
result:
ok single line: '499950'
Test #58:
score: 25
Accepted
time: 704ms
memory: 451712kb
input:
acacababababaaacaaacacacaaaaabaaaaacacabacababacabacaaaaababaaacacacacacaaaaacacaaaaaaababaaaaabacaaacacabababaaacacacaaaaacacabacaaacacabacaaaaaaacacabaaababababacacaaaaaaacabacacaaacacacabaaabacaaabaaacabababacacaaacabacabaaabacabacaaabaaacaaacacaaaaabacacabaaacaaacacaaacacabaaacaaabababacaaacacac...
output:
537438
result:
ok single line: '537438'
Test #59:
score: 25
Accepted
time: 215ms
memory: 250628kb
input:
baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
76
result:
ok single line: '76'
Test #60:
score: 25
Accepted
time: 449ms
memory: 407152kb
input:
baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
3
result:
ok single line: '3'