QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#574178 | #8521. Pattern Search II | yanshanjiahong | AC ✓ | 817ms | 31232kb | C++20 | 1.6kb | 2024-09-18 20:59:53 | 2024-09-18 20:59:56 |
Judging History
answer
#include<bits/stdc++.h>
#include<bits/extc++.h>
#define rep(i,j,k) for(int i=j;i<=k;i++)
#define repp(i,j,k) for(int i=j;i>=k;i--)
#define ls(x) (x<<1)
#define rs(x) ((x<<1)|1)
#define mp make_pair
#define sec second
#define fir first
#define pii pair<int,int>
#define lowbit(i) i&-i
using namespace std;
typedef long long ll;
const int N=2e5+5,M=1e6+5,S=(1<<15)+5,inf=1e9+7,mo=1e9+7;
void read(int &p){
int x=0,w=1;
char ch=0;
while(!isdigit(ch)){
if(ch=='-')w=-1;
ch=getchar();
}
while(isdigit(ch)){
x=(x<<1)+(x<<3)+ch-'0';
ch=getchar();
}
p=x*w;
}
int n,fib[45],cntf,sid;
char s[N];
int f[N][40];
int check(int dep,int le,int ri,int ql,int qr,int stp){
if(ql<=le&&qr>=ri)return f[stp][dep];
int mid=le+fib[dep-1]-1,res=stp;
if(ql<=mid)res=check(dep-1,le,mid,ql,qr,res)+1;
if(qr>mid)res=check(dep-2,mid+1,ri,ql,qr,res)+1;
return res-1;
}
signed main(){
scanf("%s",s+1);
n=strlen(s+1);
fib[0]=fib[1]=1,cntf=1;
while(fib[cntf]<3*n)
cntf++,fib[cntf]=fib[cntf-1]+fib[cntf-2];
rep(i,1,3)
cntf++,fib[cntf]=fib[cntf-1]+fib[cntf-2];
rep(i,1,n){
if(s[i]=='a')f[i][1]=i,f[i][0]=i-1;
else f[i][0]=i,f[i][1]=i-1;
}
rep(j,2,cntf){
rep(i,1,n)
f[i][j]=(f[i][j-1]==n?n:f[f[i][j-1]+1][j-2]);
}
int j=0,ans=inf;
rep(i,1,fib[cntf]){
if(j<i)j=i;
while(j<=fib[cntf]&&check(cntf,1,fib[cntf],i,j,1)<n)
j++;
if(j>fib[cntf])break;
ans=min(ans,j-i+1);
}
printf("%d\n",ans);
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3796kb
input:
aabbaab
output:
8
result:
ok 1 number(s): "8"
Test #2:
score: 0
Accepted
time: 1ms
memory: 5848kb
input:
a
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3936kb
input:
b
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
aa
output:
2
result:
ok 1 number(s): "2"
Test #5:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
bb
output:
3
result:
ok 1 number(s): "3"
Test #6:
score: 0
Accepted
time: 0ms
memory: 3912kb
input:
ab
output:
2
result:
ok 1 number(s): "2"
Test #7:
score: 0
Accepted
time: 0ms
memory: 3932kb
input:
ba
output:
2
result:
ok 1 number(s): "2"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
bbba
output:
7
result:
ok 1 number(s): "7"
Test #9:
score: 0
Accepted
time: 0ms
memory: 3932kb
input:
abbbbbbbab
output:
20
result:
ok 1 number(s): "20"
Test #10:
score: 0
Accepted
time: 0ms
memory: 3928kb
input:
abbbbabbbabbbabbabaabbabb
output:
43
result:
ok 1 number(s): "43"
Test #11:
score: 0
Accepted
time: 1ms
memory: 3944kb
input:
bbbaabaabbbaabababbbabaaabaaabbbaaaabaabaaaaabbabbbababbabaaba
output:
94
result:
ok 1 number(s): "94"
Test #12:
score: 0
Accepted
time: 1ms
memory: 3872kb
input:
ababaaabbaaaabaaaaabbabbbababaabaabbabbabaaaabbbabbaaaabaaaabbbabaaaaabbbbbbbbaabaabaabbbbbbabbaabaaaabbbabbbaaabaaabaababaabbbbbbbbaabababaabbaabbbaaaaabb
output:
245
result:
ok 1 number(s): "245"
Test #13:
score: 0
Accepted
time: 2ms
memory: 3996kb
input:
aaaabbbbaaaaababababaaabbbbbbababbaaaaabaaaaaabababbaabbbabbabbbbabbbabaabaaaabababaabbbaaaaabbbabaabaaaababaabbaaabbbaaaabbbaabbaaabbabbbabbabbaababbbbabbbbbbabbaaabbaabbbbbbabababbaaababbaaaaaaabaabbaabbabbbaaaaaaaaaababbaaaabaabbbabbbaabbabbbaabaaaaaabaababaaaababaaaaaababbaaaaaabaabbaabbbbbbaaba...
output:
625
result:
ok 1 number(s): "625"
Test #14:
score: 0
Accepted
time: 4ms
memory: 4088kb
input:
aabaababbbbbbbbaabaaaaaabbbaababbabbabbaabbaaaaabaaaabbbbababbaabaaaaaabbbbabbbbbbbabbbaababbbbbbabaaababbaabaaaabbaababbbaaabbabababbbbbabbbaaaaaabbaabbbbabbabbaaaaaabababbabbbbabaabbbbbbbbaaabababbbbbbbaaababbbbbbabbbbabbaaabbbbaaabaaabbaabaabbaaaabababbabbabababbbaabbbbbabaaabbbabbbababbaababbbba...
output:
1608
result:
ok 1 number(s): "1608"
Test #15:
score: 0
Accepted
time: 10ms
memory: 4356kb
input:
aaababbbabbaabbbababbaaababaabbbbbabbbabbbabbabbaabbabbabaaabaabbbbbabababbbabaaaabaaababbabaaaabababbaabbaaaaaababaabababbbaaaabbababbbaaaaabababbaaaaabaabbbbbbaabaaaabbbaaababaabbbabaabaaababbbaaaaaabbbbbbbabbbabbaaaababbababaababaabbbbbaaaaabbababbbaabaabbabbaabbbbabaaabbababaaaabbbabaaabaabbbbab...
output:
3954
result:
ok 1 number(s): "3954"
Test #16:
score: 0
Accepted
time: 29ms
memory: 4804kb
input:
aaabbbbabaaabbabbaabbabbbbbbbaaabbaaaaabbbbbaaaabbbaaabbabbaabaabbbaabaababaabbbababbbbbbabbababbbbabaaababbbaaabbabbbaabbbbbbbbbbabbbbbabbabbbbabbbbbbbaabaaaaaabbbaaabaabaaaaabbabbaaabbababaaaaaababbbabaabbbaabaaabaabbabaaaaababaaabbaabaababbaaabaabbaabbbbaababbaabaaabababbbbbabbbbababbbbbbaabbabab...
output:
10033
result:
ok 1 number(s): "10033"
Test #17:
score: 0
Accepted
time: 43ms
memory: 7552kb
input:
aabbbbbabababbbababaaabaabbbbbbaaababaabaababbbbbaabaabababaabbbbbbaabbbababbbbbbbbbbabababbabbaaaabaaaaabbabbbabbaaaaababababaaabbbbbbbabbbbbbbbaaabbbaaababbaaaaaabaabbaababbbabaaabbbaabbabababbaaaababbbabbbabaaaaabbbabbbabbaaaabababbbbbbaabbbaaaabbabbabbabbbbbbbaabbbaabbbbabbbaabbbbbbabaaaabbaaabb...
output:
24882
result:
ok 1 number(s): "24882"
Test #18:
score: 0
Accepted
time: 134ms
memory: 10096kb
input:
bbabaaababbabbbbbbababaababaaabababaabbbaabbbabbababbbbbabbbbaaabbbbaaaaabbaaabbbabbbbaabaabbaaaabaababbbababbbbaaaaabaabaababbbbbabbbabbaaabbabbbbaabbabababababababaabbaabbaabbabaaaabaaabbbbbababbbbaaaaabaababbbbabaaaabababaaabaaaabbbbabbbbabaaaaaababbbbabaaabaaaabaaabaabaabaabaaabbabbbbabbababaaab...
output:
62283
result:
ok 1 number(s): "62283"
Test #19:
score: 0
Accepted
time: 382ms
memory: 19104kb
input:
bbbaabaababbaababbbbbbabbbbbbabaabbaaaaabbabbbbbabbabaabbbbaabaaababaaababbaaabababbabbababbbabaabbbabbabbabaabbbbaabaaabbaaabaaabbaaaaabaababbaabaaaabbbbababaababbabaaabababbaabbabbbabbababaaabbbbbabababbaabbbabaaabbaabaababaabbbaabbbaaabbbbabaabbbaaaabbbababaabbaaabaaababbbaabbbaabbbbbabababbababb...
output:
155673
result:
ok 1 number(s): "155673"
Test #20:
score: 0
Accepted
time: 481ms
memory: 17624kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
121390
result:
ok 1 number(s): "121390"
Test #21:
score: 0
Accepted
time: 416ms
memory: 17068kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
196413
result:
ok 1 number(s): "196413"
Test #22:
score: 0
Accepted
time: 474ms
memory: 15984kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
121392
result:
ok 1 number(s): "121392"
Test #23:
score: 0
Accepted
time: 418ms
memory: 15792kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
196416
result:
ok 1 number(s): "196416"
Test #24:
score: 0
Accepted
time: 484ms
memory: 15992kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
121394
result:
ok 1 number(s): "121394"
Test #25:
score: 0
Accepted
time: 417ms
memory: 17548kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
196419
result:
ok 1 number(s): "196419"
Test #26:
score: 0
Accepted
time: 803ms
memory: 23500kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
196415
result:
ok 1 number(s): "196415"
Test #27:
score: 0
Accepted
time: 696ms
memory: 23324kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
317806
result:
ok 1 number(s): "317806"
Test #28:
score: 0
Accepted
time: 811ms
memory: 24256kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
196417
result:
ok 1 number(s): "196417"
Test #29:
score: 0
Accepted
time: 701ms
memory: 23724kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
317809
result:
ok 1 number(s): "317809"
Test #30:
score: 0
Accepted
time: 809ms
memory: 25000kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
196418
result:
ok 1 number(s): "196418"
Test #31:
score: 0
Accepted
time: 725ms
memory: 24852kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
317811
result:
ok 1 number(s): "317811"
Test #32:
score: 0
Accepted
time: 811ms
memory: 29452kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
242701
result:
ok 1 number(s): "242701"
Test #33:
score: 0
Accepted
time: 702ms
memory: 27980kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
392698
result:
ok 1 number(s): "392698"
Test #34:
score: 0
Accepted
time: 817ms
memory: 29048kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
242702
result:
ok 1 number(s): "242702"
Test #35:
score: 0
Accepted
time: 695ms
memory: 27748kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
392700
result:
ok 1 number(s): "392700"
Test #36:
score: 0
Accepted
time: 813ms
memory: 29448kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
242704
result:
ok 1 number(s): "242704"
Test #37:
score: 0
Accepted
time: 712ms
memory: 28100kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
392703
result:
ok 1 number(s): "392703"
Test #38:
score: 0
Accepted
time: 797ms
memory: 27752kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
242702
result:
ok 1 number(s): "242702"
Test #39:
score: 0
Accepted
time: 654ms
memory: 28700kb
input:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
output:
242583
result:
ok 1 number(s): "242583"
Test #40:
score: 0
Accepted
time: 586ms
memory: 29044kb
input:
abaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaabaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaabaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaabbaaaaaaaaaaaaaaaaaaabaaaaabaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaabaaaaaaabaaaaaaaaaaaaaaaaaaaaaaa...
output:
233809
result:
ok 1 number(s): "233809"
Test #41:
score: 0
Accepted
time: 696ms
memory: 29012kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
392700
result:
ok 1 number(s): "392700"
Test #42:
score: 0
Accepted
time: 694ms
memory: 28144kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
392441
result:
ok 1 number(s): "392441"
Test #43:
score: 0
Accepted
time: 612ms
memory: 28268kb
input:
bbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbabbbbbbbabbbabbbbbbbbbbabbbbbbbbbbbbbaabbbbbbbbbabbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbabbbbaabbbbbbbbbbbbbbbbbbbbbbbbbabbabbbbbabbabbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbaababbbbbbababbabbbbbbbbbbbbbbbbbbbbbbbabbabbbbbbbbbbbbbbbbbbb...
output:
367219
result:
ok 1 number(s): "367219"
Test #44:
score: 0
Accepted
time: 0ms
memory: 5916kb
input:
abaaaabbaabaababaababaabaabbaabaabbabbababbbbaaabbbbbaababbbababbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
output:
180
result:
ok 1 number(s): "180"
Test #45:
score: 0
Accepted
time: 1ms
memory: 3864kb
input:
abbaabbbababbaaabbabbabbbabbabbaabaaaabbbbabbbbbaabaabbaaabbababbbbbaaaaaaababbababbabaabbbbbbbbbbbb
output:
177
result:
ok 1 number(s): "177"
Test #46:
score: 0
Accepted
time: 3ms
memory: 4076kb
input:
aabaabbabaaaaaababbbbbaababaabaabbaaaabaabbababbbabaabaababbababbbbaababaabbaabbbbaabbababaaababbaaaaaabaababbbbababbbbabbababaaaaaabaaababaaababbabaaaabbbabbaababbabbbbbbaababbaabbbabaabaabaaababbabbabbabababaaabbbbaaabbbabbbabbabbbbabbabbbbababbaaabbaaabaababbaabbbaaabaabaaabbabbaabbbbbbabbbaaaabb...
output:
1673
result:
ok 1 number(s): "1673"
Test #47:
score: 0
Accepted
time: 4ms
memory: 3948kb
input:
baababaabaababaaabaabbbababbaaabbaabaaababbbbbaaaaababbbaaaaaaaabaaabbbaabbbbaabbabbabbbabaaaabbaabbaabbababbbbabbbaaabbbaabababababaabbbababaabbbbabbbbbaaaababaabbabbbabaaaabaaaaabaabaabbabbaabaaababbbabaaaabaaaabaaaaabbbbbbabbababaaababbbaabababbbbbbbbbababbbbbababbbabaaaabbabbbabbbabbbbaaaabaabab...
output:
1719
result:
ok 1 number(s): "1719"
Test #48:
score: 0
Accepted
time: 628ms
memory: 28568kb
input:
abbbbbbababaaabbaabbbbaaabbbababbaaabbabbbbaabbbabbbbabbbabbaabbabbbbabaaabbaabbbabbababaaaaabaabbababbbaabbabbbaaaababbbaabbbabaaababaabbabbaabbbabbabbbababbabababbaaaaaaabbabbbbbaabaabbbbaaaaabbaabaabbbbbaaabbbabbaaabbabbaaaaaaaaababbaabbaabbbbbbbbbababaaababababbabbbaabbbabbaabaabbbbbbbbbbbaabaaa...
output:
246836
result:
ok 1 number(s): "246836"
Test #49:
score: 0
Accepted
time: 622ms
memory: 28152kb
input:
aaaaaaabbbaaabbbabbbabbbababababbbbaaabbbbbabbabbbbbaabbaabababbabbaabbbbbbbabbbbabbbabaaababaaabaaaabaaaaabababaabaabaaaaababbbaabbaaabbbabaabbaaabbaabbaaabbbabaabbaaaabbabbbaababbababbbbbbaabbbaaaaabaaababaaaababbbabbaabaabbbbabbabbabbbbbbbababbaababaababbbbbaaabaaaabbaabaaabababbbbabaaabaaaababbb...
output:
246901
result:
ok 1 number(s): "246901"
Test #50:
score: 0
Accepted
time: 607ms
memory: 27588kb
input:
baabbbaaaabbbbbaababbabbaaaaaaaaabaaaabbaaabbabbbbbbbbbaaaaabbbbbababbbbbbbbbbbabbbbabaaabbbbbabbaabbbabababaabbaababbbababaaabbbababaaaaabaaaabababbabaabbbabbbbaabaaaababbaabbbbbabababaabbbbbabbbbbaaabaaababaababbabaabababbbbaabababbabbbabbabbbbababaabaaaabbbabbabaabaabbbabbbaabaabababaaaaaabbbabbb...
output:
246841
result:
ok 1 number(s): "246841"
Test #51:
score: 0
Accepted
time: 608ms
memory: 28136kb
input:
aabbbbaaabbaabaabaabbabbbaaaababaabaaaaababbabbaabbaababbbbabbaaaabbaaaaabaabbaabbbabaaababaabbbbbababbbaababababbbbbbaaaabbbabaaabbbabbbbaababbaabaabbaaababbbababaaabbbbbbaaaabbbaabaaabbbbbaabababaaaaababbabbaabbbbbabbabaabbaaabbbabababbabbababbabbbbbaaabbaaabaabaaabbbaabbbabbaabaaaababbbabbabbaaba...
output:
246720
result:
ok 1 number(s): "246720"
Test #52:
score: 0
Accepted
time: 620ms
memory: 25532kb
input:
baabbaabbbabbabbbbbababbbabbbaababbbabbbbbabbbbbbabbbbbbbabbbaabbbbbbbbbbbbbbbaaaabbbbbbabbbbbabaaabbbbbbbabbbabbbababbbbabbbaaabbbaabbbbbbbabbbbbaabbabbbabbbabababbaababbbbabbabbbbbabbbabbbbbbbbaaabbaababbbbbabbbbbbbbbbabbaabbabbbbbbbbbabbabbababbbabbbabbbabbbbbbbabbbbbbbbbabbbbbbbbbbbbbababbabbbaa...
output:
266491
result:
ok 1 number(s): "266491"
Test #53:
score: 0
Accepted
time: 598ms
memory: 25476kb
input:
bbbbbbbbbbbbbaababbbaababbbbbbbbbabbbbbbbbbbbbabbbbbabbbababbbaabbabbbbbbbbabbbbbabbbbabbbbbbbbbbbabbbbbbabbbbbbabbabaaabbbababbaabbbbbabbbbbbbabababbbbbbbbbabbbbabbabbbaabbbaabbbbabababbbbbabababbabbbbababbbabbabbbababbbbbbbbbababbbbbbbbbababbbbbbbbbbbabbabbbabbbbaabbbbabbbabbbbbbbabbbbbbbabbbbbbba...
output:
266645
result:
ok 1 number(s): "266645"
Test #54:
score: 0
Accepted
time: 600ms
memory: 24832kb
input:
bbbbbbbabbbbabbbbbbabbbaaabbabaabbabbbbbbbbabbbaaaabbbbabbbabababbbbbbbbbbbabbbaabbbbbbbabbbbbbbbbbbbbbabbbaabbbbababbbbbbbabbbaabbabbbabbbabbbaabbaabaabaabbbbaabbbabbbaabbbbabbbbbaabbbaaaaabbbbbbbbabbbbbbaabbbbbababbbabbbbbbbabbbbbbbabbbbbbbabbaababbbbbbbbbbbbabbabbaaaababbbbbabbababbbbabbbabbbbaba...
output:
266745
result:
ok 1 number(s): "266745"
Test #55:
score: 0
Accepted
time: 599ms
memory: 27660kb
input:
babbbbabbbababaababbbbaaaababbbbbbabbaabbbaaaabbbbbabbbbbaababbababbbabbbbbbbbbaabbbaabbabbbbbbbbbbbbbbbaababbbaaaaabbbabbababababbaababbbaaabbbbbbabaabbbabbbbbbababbabbabbabbbaaaabbaababbbabbbbaabbbbaabbbbbbbbbbbbaabbbabbbabbbabbbabbbbbbbbabaaabbabbbbbaababbababbbababbababbbbbbbbaabbababbaaaabbbbbb...
output:
282172
result:
ok 1 number(s): "282172"
Test #56:
score: 0
Accepted
time: 621ms
memory: 29600kb
input:
babbbbbaabbbbabbbbbbbbbbabbabbbbabbbbbbbbbaabbaabbbbbaababbbabbbbbbbbbbbbabbbbbabbbbabbabbabbbbabbabbababbbbbbbbabbbbabbbbbbbbbbbbaababaabbbbbbbbbbbbaabbaabbabbbaaaabbbabababbbbbbbbbabbbbbabbbababbbbbbabbbbbbbbabbbbaaaabbbbaababbbbbbbbabababbbbbbabbbbbabbbbbbbaababaaababbbabbabbababbbabbbbbbbaabbbbb...
output:
305384
result:
ok 1 number(s): "305384"
Test #57:
score: 0
Accepted
time: 577ms
memory: 27548kb
input:
babbbaaabbaabbbbbbabbbaaabbabaabbbbbbbbbbbbbbabbbbbbbaabbbbbbbbbbbbbbbbbbbbbbbbababbabbbbbbbabbbbbbbbbbbbabbbabbbbbbbabbbbabbbbabbbbbbaabbbbbbbabababbbbabbbbbabaaaabbbbabbbbbabbabbbbbbabbbbbabbabbabbbbbbbabbababbbbbbbababbbbbabbbbbbbbabbbabbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbabbababbbbbabbbbbbbbbbbbba...
output:
320836
result:
ok 1 number(s): "320836"
Test #58:
score: 0
Accepted
time: 588ms
memory: 31232kb
input:
babbbabbbabbbaaabbbbababbabbbaababbbbbbaabbbabbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbabbbbababaabbbabbbbbbbbbbbaabbbbbbabbbbbbbbbbbbbbabbbbbbbbbabbbbbbbabbbbbbbbbbbbbabbbbbbbbabbbbbbbbabbbbbbbbaabbbbbbbbbabbbbbbbbbababbbbbbaabbbbbabbbbbbbbbbbaabbbbbbbbbbbbbbabbbbbabbbbbaabbbbbabbbbbbabbbbbbbababbbbb...
output:
332069
result:
ok 1 number(s): "332069"
Test #59:
score: 0
Accepted
time: 592ms
memory: 28508kb
input:
bbbbbabbbabbbbbbbabbbaabbabbbbabbbaababbababbbbbabbbabaabbabbbbbbbababbbbbbbabbbbababaabbbbaababaabbabbabbbbaabbabaaabaabbbbbbbbbbaabaabbbbabaabaaabbbbbbabaabababbbabbbabbbabbbbbbbbabbbbabbbabaaababbaaabaaabbbbbbaabbbbabbbabbababababbaababbaabbbabbbbabaaabbaaabaabbbbbbaabbbabbababbaabbbbabbabbbabbbb...
output:
281875
result:
ok 1 number(s): "281875"
Test #60:
score: 0
Accepted
time: 606ms
memory: 29384kb
input:
bbabbbbbbabbbbbbbbbbbbbbbbbbabbbaabbbabbbbbbbaabaababbbbbaaabbabbbbabbbbaabbbbbabbbbbbbaabbbabbbbbbabbbabbabbabaaabbabaabbbaabbbbbbbbbbaabababaaabbbbbaabbbbabbbbbabbababbabababbbabbbabbbbbabbabbbbaabaabbbbabaabbabbabbbbbbababbbbbabbbbbabaabbbbbbbbabbbabbbbabbbbbbbabbabbabbbbbaababbbbabbbbbbbbbabbbbb...
output:
305753
result:
ok 1 number(s): "305753"
Test #61:
score: 0
Accepted
time: 592ms
memory: 29152kb
input:
babbbabbbabababaabbbabbabbbbbbababbbbbbbbbbabbbbbabababbbbbbabbbbbbbbbbbbbbbabbbbbbbbabbbbababbabbabbaaabaabbbbbbbbabbbbbbbbaabbabbababbbbbbbbbbbabaabbbbbbbbbbbabbbbbababaabbbaabbbbbbbbbabbbbababbaabaababbbbababbbbbabbbbbabbbbbbbbabbbbbbbbabbbaabbbbbbbbbbbbbabbbbbabbbbbabbbababbbbbbbbbbbbbaabbbbbbab...
output:
321150
result:
ok 1 number(s): "321150"
Test #62:
score: 0
Accepted
time: 599ms
memory: 28236kb
input:
bbbbbabbabbbabbbbbbbbabbbbbbabbbbabbbabbbbbbbbbbbbabbbababbbbbbbbbbbbbbbbbbbbbbabbbbbbabbbbabbbbbabbbbbabbbbbbabbbababbbbbbbbbabbbbababaabbbbbbbbbbbbabbbbbbbbbbbabbbbbbababbbbbbbbabbbbabbbbbbbbabbbbbbabbbbabbbabbbbbabbbbbbbbbbbbbbbbabbbbbbabbbababbbbbabbbbabbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbabbba...
output:
331900
result:
ok 1 number(s): "331900"
Test #63:
score: 0
Accepted
time: 609ms
memory: 28336kb
input:
bbbabbbbbbbabbbbbabbababaabbabbbbabbbbbbbbabbbabbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbabbbbabbbbbbabbbbabbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbabbabbbbbabbbbbbbabbbbbbabbbbbbbbbabbbbbbbbbbbbababbbbbbbbbbbbaabbbbbbababbbbbbbbbbbbabbbabbbbbbbbbbbbbaabbbbbbbbbbbbabbbabbbbabbbabbbbbbbbbbabbbbabbbb...
output:
339945
result:
ok 1 number(s): "339945"
Test #64:
score: 0
Accepted
time: 572ms
memory: 28740kb
input:
bbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbabbbbbbbbabbbbbbbbbbabbbababbbbabbbabbbbbbbbbbbabbbbbbbbbbbabbbaabababbbbbbabbbbbbbbbbbbbbabbbbbbbbbbbbabbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbabbbbbbbababbbbbabbabbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbaabbbbbbbbabbbbbbbbba...
output:
346933
result:
ok 1 number(s): "346933"
Test #65:
score: 0
Accepted
time: 620ms
memory: 28252kb
input:
abaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaa...
output:
150000
result:
ok 1 number(s): "150000"
Test #66:
score: 0
Accepted
time: 594ms
memory: 28092kb
input:
babaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaaba...
output:
150000
result:
ok 1 number(s): "150000"
Test #67:
score: 0
Accepted
time: 619ms
memory: 28620kb
input:
ababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaabab...
output:
150001
result:
ok 1 number(s): "150001"
Test #68:
score: 0
Accepted
time: 590ms
memory: 27536kb
input:
baababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaabaababaababaabaababaababaabaababaabaababaababaabaababaababaabababaabaababaababaabaababaabaababaababaa...
output:
151000
result:
ok 1 number(s): "151000"
Test #69:
score: 0
Accepted
time: 645ms
memory: 28436kb
input:
baabaabaaaabaaaaaabbababaaaaabaabbaaaabbaabaababaaaabbaababaabbabaababbaabaababbabaaababaaaabbaabababbaabaaabbabaababababaaabaabaaababaaababaabababaabaababaababaababaabaabaababbaabaaabaabaabbaababbababaaabaaabbaabaabaabaaaabbaaaaababbabababaabaaabaabaabababababbabaaaabaababaabaabababababababaabababa...
output:
199864
result:
ok 1 number(s): "199864"
Test #70:
score: 0
Accepted
time: 558ms
memory: 27596kb
input:
bbaabaababaaabababaababaabababaababababbabababababaabaabbaabababababaaabaaaaabaaababaaabaabababaabaababaaaababaaaabbaaaabaaabbaaabbabababaabbaabaabbaabababaabbaaabbabaabaabababaabbaabaaaabaabababaabaababaabaaabbaababaaaabababababaabaaaababaabaababbabaababaabababaabaababaabababababbababaaabaabaababab...
output:
196473
result:
ok 1 number(s): "196473"
Test #71:
score: 0
Accepted
time: 589ms
memory: 31136kb
input:
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
346417
result:
ok 1 number(s): "346417"
Extra Test:
score: 0
Extra Test Passed