QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#463874#5166. 回文匹配Iratis35 316ms217728kbC++144.3kb2024-07-05 15:28:592024-07-05 15:28:59

Judging History

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

  • [2024-07-05 15:28:59]
  • 评测
  • 测评结果:35
  • 用时:316ms
  • 内存:217728kb
  • [2024-07-05 15:28:59]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define md(a) a=(a%mod+mod)%mod
#define file(a) freopen(#a".in","r",stdin);freopen(#a".out","w",stdout)

bool ST;

const int N=1000005,B=5e5,P1=36634229,mod1=998244353;
int pw1[N*2];
int Test,n,Q,Ans[N],qx[N],qy[N];char str[N],s[N*2];vector<int>inc[N],qry[N];
bool vst[N];int all,t,st[N],top,lim[N*2];vector<int>req[N];

const int M=19491001;
struct Hash_Table
{
	int h[M],st[M],top,tot,val[N*2],f[N*2],nxt[N*2];
	inline void ins(int v)
	{
		int x=v%M;
		for(int k=h[x];k;k=nxt[k])if(val[k]==v){f[k]++;return ;}
		tot++;if(!h[x])st[++top]=x;f[tot]=1,val[tot]=v,nxt[tot]=h[x],h[x]=tot;
	}
	inline int ask(int v)
	{
		int x=v%M;
		for(int k=h[x];k;k=nxt[k])if(val[k]==v)return f[k];
		return 0;
	}
	inline void Clear()
	{
		while(top)h[st[top]]=0,top--;tot=0;
	}
}Map;

int il1[N],dl1[N],ir1[N],dr1[N*2],ha1[N];
inline void ad1(int&x,int y){x+=y;if(x>=mod1)x-=mod1;}
inline void de1(int&x,int y){x-=y;if(x<0)x+=mod1;}
int scc=0;
struct num
{
	int m,len,h1n;vector<int>f;
	inline void read(int id)
	{
		cin>>(str+1);m=strlen(str+1);s[0]=' ';
		for(int i=1;i<m;i++)s[++len]=str[i],s[++len]='#';s[++len]=str[m];f.resize(len+1);
		for(int i=1,p=0,mid=0;i<=len;i++)
		{
			if(i<=p)f[i]=min(p-i+1,f[mid*2-i]);
			while(i-f[i]>=1&&i+f[i]<=len&&s[i-f[i]]==s[i+f[i]])f[i]++;
			if(i+f[i]-1>p)p=i+f[i]-1,mid=i;
		}
		if(m<B)inc[m].push_back(id);
		// for(int i=1;i<=len;i++)cout<<f[i]<<' ';cout<<'\n';
	}
	inline void gethash()
	{
		h1n=0;
		for(int i=1;i<=len;i++)
		{
			int a=f[i];if(a>=lim[i])a=5e6+1;
			// cout<<a<<'\n';
			h1n=(1ll*h1n*P1+a)%mod1;
		}
	}
	inline void up(int l,int r,int st,int v)
	{
		if(l>r||r<1)return ;if(l<1)st+=(1-l)*2,l=1;
		// cout<<"up:"<<l<<' '<<r<<' '<<st<<' '<<v<<'\n';
		ad1(il1[l],1ll*pw1[st]*v%mod1),ad1(dl1[r],1ll*pw1[st+(r-l)*2]*v%mod1);
	}
	// inline void dn(int l,int r,int st,int v)
	// {
	// 	if(l>r||l>m)return ;if(r>m)st+=(r-m)*2,r=m;
	// 	cout<<"dn:"<<l<<' '<<r<<' '<<st<<' '<<v<<'\n';
	// 	ad1(ir1[r],1ll*pw1[st]*v%mod1),ad1(dr1[l],1ll*pw1[st+(r-l)*2]*v%mod1);
	// }
	inline void Run()
	{
		int l1=0,r1=0,l2=0,r2=0;
		l1=0,r1=(t-1)/2,l2=r1+1,r2=t-1;
		// cout<<l1<<' '<<r1<<' '<<l2<<" "<<r2<<'\n';
		for(int i=1;i<=len;i+=2)
		{
			int x=(i+1)/2,d=(f[i]-1)/2,p=0;if(!f[i])d=-1;
			p=min(d,r1-l1);up(x+l1,x+p,l1*2,5e6+1),up(x+p+1,x+r1,(p+1)*2,f[i]);
			p=min(d,r2-l2);up(x+r2-p,x+r2,(r2-p)*2,5e6+1),up(x+l2,x+r2-p-1,l2*2,f[i]);
			// dn(x+r2-p,x+r2,0,5e5+1),dn(x+l2,x+r2-p-1,(p+1)*2,f[i]);
		}
		l1=0,r1=t/2-1,l2=r1+1,r2=t-2;
		// cout<<l1<<' '<<r1<<' '<<l2<<" "<<r2<<'\n';
		for(int i=2;i<=len;i+=2)
		{
			int x=i/2+1,d=f[i]/2-1,p=0;
			// cout<<x<<" "<<p<<'\n';
			p=min(d,r1-l1);up(x+l1,x+p,l1*2+1,5e6+1),up(x+p+1,x+r1,(p+1)*2+1,f[i]);
			p=min(d,r2-l2);up(x+r2-p,x+r2,(r2-p)*2+1,5e6+1),up(x+l2,x+r2-p-1,l2*2+1,f[i]);
		}
		for(int i=1,h1=0;i<=m;i++)
		{
			h1=1ll*h1*pw1[2]%mod1;
			ad1(h1,il1[i]);
			ad1(ha1[i],h1);
			de1(h1,dl1[i]);
		}
		for(int i=1;i<=m;i++)if(i>=t)
		{
			Map.ins(ha1[i]);
		}
		for(int i=1;i<=m;i++)il1[i]=dl1[i]=ha1[i]=0;
	}
}a[N];

inline void Run(int id)
{
	a[id].Run();
	for(int qid:req[id]){int x=qx[qid];Ans[qid]=Map.ask(a[x].h1n);}
	Map.Clear(),req[id].clear();
}

inline void calc()
{
	for(int id:inc[t])for(int qid:qry[id])
	{
		int y=qy[qid];req[y].push_back(qid);
		if(!vst[y])st[++top]=y,vst[y]=1;
	}all=t*2-1;if(!top)return ;
	for(int i=1;i<=all;i++)lim[i]=min(i,all-i+1);for(int id:inc[t])a[id].gethash();
	while(top)Run(st[top]),vst[st[top]]=0,top--;
}

inline void calc2(int id)
{
	t=a[id].m;
	for(int qid:qry[id])
	{
		int y=qy[qid];req[y].push_back(qid);
		if(!vst[y])st[++top]=y,vst[y]=1;
	}all=t*2-1;if(!top)return ;
	for(int i=1;i<=all;i++)lim[i]=min(i,all-i+1);a[id].gethash();
	while(top)Run(st[top]),vst[st[top]]=0,top--;
}

bool ED;

signed main()
{
	cerr<<(&ST-&ED)/1024.0/1024<<endl;ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	// file(match);
	pw1[0]=1;for(int i=1;i<N*2;i++)pw1[i]=1ll*pw1[i-1]*P1%mod1;
	cin>>Test>>n>>Q;for(int i=1;i<=n;i++)a[i].read(i);
	for(int i=1;i<=Q;i++){int x,y;cin>>x>>y;qx[i]=x,qy[i]=y;if(a[x].m<=a[y].m)qry[x].push_back(i);}
	for(int i=1;i<B;i++)t=i,calc();for(int i=1;i<=n;i++){if(a[i].m>=B)calc2(i);}
	for(int i=1;i<=Q;i++)cout<<Ans[i]<<'\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 97ms
memory: 140172kb

input:

0 2 500000
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

0
1
0
487
1
0
1
487
0
1
0
0
1
0
0
0
487
0
0
0
487
0
1
0
1
487
0
0
0
0
487
487
0
0
487
487
1
0
1
0
1
0
0
487
0
0
1
0
0
0
487
1
0
1
1
1
0
0
0
0
0
0
0
0
0
487
0
0
0
0
1
0
0
0
0
487
487
487
0
1
487
487
1
0
1
1
0
487
0
487
0
0
0
487
0
1
487
487
1
0
0
0
0
0
1
487
0
1
0
0
1
1
1
0
0
487
0
0
0
0
1
0
0
0
0
1
...

result:

wrong answer 1st words differ - expected: '1', found: '0'

Subtask #2:

score: 15
Accepted

Test #10:

score: 15
Accepted
time: 316ms
memory: 168516kb

input:

0 500000 500000
v
s
o
w
f
c
z
u
d
b
z
h
b
e
w
p
n
l
e
i
e
h
g
h
o
q
u
x
n
k
t
z
i
f
e
t
q
b
s
h
o
q
k
n
k
t
d
x
t
u
p
w
l
h
g
j
c
q
n
i
s
o
v
s
u
e
n
c
j
f
u
w
q
g
u
p
v
w
z
w
p
r
d
n
m
v
d
z
n
j
l
o
n
v
y
u
j
x
j
v
a
e
x
r
l
s
x
g
u
a
h
u
c
b
z
k
b
t
g
h
o
g
k
t
l
u
i
c
q
p
v
c
s
s
s
l
i
c
h
t
o
s
...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 500000 tokens

Test #11:

score: 0
Accepted
time: 281ms
memory: 154624kb

input:

0 250000 500000
di
ne
pk
cw
la
bt
cx
hs
ku
ga
rq
zq
jo
zr
at
ue
og
sl
su
ju
gy
oo
om
ev
df
bm
jh
um
vw
ts
qs
we
pn
pe
zc
zb
nl
ld
kl
pl
tk
uh
cm
hn
qb
xi
wb
lu
kq
gf
vc
eq
xe
ni
se
ng
kn
rt
zd
bv
vb
vn
ui
dz
kn
do
cg
nn
ct
mz
op
od
lu
cb
ra
ib
dk
lh
xh
wh
ny
ws
jw
lh
vk
bl
ak
an
rz
xv
sm
zt
mp
yr
an...

output:

1
1
1
0
1
1
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
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
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
0
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 500000 tokens

Test #12:

score: 0
Accepted
time: 171ms
memory: 146240kb

input:

0 50000 500000
qkubvtpdzm
soafdgztoz
dzihbjgzlv
qzmgwddcum
edjlwzdesz
uzdcradqvu
keljvoztlv
rwibigjyiq
txgwbogpxx
hpkzemjevp
zgygtmqivo
vmhpsomqgj
icjqyepuzv
lgxnfnvmnk
wgetijbyql
qsglhyjkee
enfkhyfory
hwzrhlcqfj
bhifrgvfly
bpuphqsvau
yvdgurwpeo
vxyypvbpfh
ghgrliyqyb
vaunorfwvl
xzisdbfkbu
vpxuecgonr...

output:

0
0
0
1
1
1
0
1
1
0
0
0
0
0
1
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
0
0
1
0
0
0
0
1
0
1
1
0
0
0
1
0
0
1
1
1
1
0
0
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
...

result:

ok 500000 tokens

Test #13:

score: 0
Accepted
time: 131ms
memory: 157596kb

input:

0 5000 500000
wgnhspqfqmsglvytlzswiyhhryunyqtbwgrybapsfazarmqfzeyaqheruzccfiwvosvttasxklvfyiyutasgnqzielbmzfwzneea
ksqsaughjpdpmrxyqrnkenvuhhbnxjlgaxoebfgosierjxuhbxxnnupigxqjcmknzuomavqyafbwippqznniqixbbutybznxxlcg
jqhxhvoknjktzdegmtdvxapbfobchmgvxavvbksiqekqtjkvvgwkfxsuqueklxlyqlanorcambowdgzvdovf...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 500000 tokens

Test #14:

score: 0
Accepted
time: 111ms
memory: 141264kb

input:

0 200 500000
ztvrelbmgkwawltubkecueenrrxoafbslwjaeqvzzppfzxvgycgliaiwhfeyvodpsapqeyjirgclwrdflcqispbtbivlkaiecakocarlmhpdowzwjhxgpjbcccepmpceyyrwwrnmlyyioslgqbppnutbqcxhiyfntvxwslcpqnvmonyevbadqpkhlddixawynfoztkjmfsafyoolgspflnixalfeulgtuymhzpeutrquxqnkhwhezovdksbthwzirpdnhinlvnjijtytwzggcoptflsjhbl...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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 500000 tokens

Test #15:

score: 0
Accepted
time: 123ms
memory: 143660kb

input:

0 20 500000
tzfbewglzikwxyjkkathrpoidnvdudkwosfrlcnmhvoyjniwveiypahkpychzwseqsvssdqbzxkixatwwsuigjygtoxehabbsioeberecmqzmagaancqugaaxqblwleoglexgeobzhidsqydsgyhtncuhdyavcknynbeisqebyagzpengdavedutrwejzcrfpacgvohrjshpsiubwqufuaqrwzcyothsesstsjyldiddejmgpcefjbshtbojbbkytitfibgiabeonnysfswnqwkwqmaurtbe...

output:

0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
...

result:

ok 500000 tokens

Test #16:

score: 0
Accepted
time: 73ms
memory: 152156kb

input:

0 1 500000
xbfaqwhxainvubbxblsgiyhxchubsocqkdjomtvxiwrxiytdshewrcfjjxelnrdsmrjphysgoiugosyghdtmjzrzrzjkzbuyxjicfeaggqfhwleuekeldzxamxdhpfgxtlwdehoarxjxshtqyhtwehgirhdqvkxoxstpiltckqaliambfrrnighbdireuuddwgidywbazdfrclivpynyjmtwmedhowwigqcslfadgqwzqxlxhumfkbnutalszwrofjlhhfxkcazgxzpooxlgyoalhqpnmklgc...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 500000 tokens

Test #17:

score: 0
Accepted
time: 192ms
memory: 148848kb

input:

0 100000 500000
thjjy
hhhhp
nnnnn
ssssz
ttttx
xxxxx
yyyyy
yyyyy
sssss
qqqqn
ooooo
uuuuu
yyyyo
eeeee
ttttt
wwwww
bbbbb
ttttt
zzzzz
lllll
vvvvv
wwwww
xxxxx
hhhhh
lllll
nnnnn
ccccc
nexxj
yyyyq
iiiii
mmmmm
qqqqq
kkkkk
wwwww
ooooo
yyyyy
uuuuu
kkkkk
iiiih
ggggg
qqqqq
eeeee
ooooo
wmuuz
ooooo
sasss
gkffo
eu...

output:

1
0
1
1
0
0
1
1
1
0
1
0
1
1
0
1
0
1
1
1
1
1
1
0
1
0
1
0
1
1
0
0
1
0
1
1
1
0
1
1
1
1
1
0
1
1
1
1
1
0
1
1
0
1
1
1
0
0
0
0
1
0
1
1
1
0
0
0
1
1
1
0
0
1
1
1
0
0
1
1
1
0
0
0
1
1
0
0
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
1
0
0
1
1
1
0
1
1
1
1
1
0
1
0
0
0
0
0
0
0
1
0
1
1
0
0
0
0
0
0
1
1
0
0
1
1
0
1
1
1
1
0
1
1
0
...

result:

ok 500000 tokens

Test #18:

score: 0
Accepted
time: 190ms
memory: 146272kb

input:

0 50000 500000
uuuuuuueeu
yyyyyyyyqq
oooooooooo
qqqqqqqqqq
nnnnnnnnnn
nnnnnnnnnn
pppppppepp
lldldmjmmm
qqqqqqqqqq
sssssssuus
ppkzkrjrrr
ggvgvsdsss
ffffffffff
mmmmmmmmmm
oooooooooo
aaaaaaaaaa
aaaaaaaahh
fffffffvff
dddddddddd
cccccccccc
xxxxxxxexx
eeeeeeesse
wwwwwwwwww
bbbbbbbbbb
uuuuuuuuuu
eeeeueeeee...

output:

0
1
0
0
0
0
1
0
0
1
1
0
0
0
1
0
0
1
1
1
1
0
0
0
1
1
0
0
1
0
0
1
0
0
1
0
1
1
1
1
0
0
1
1
1
1
0
0
1
0
0
1
0
0
0
0
0
1
0
1
1
1
1
1
0
0
1
1
0
0
0
1
1
0
0
0
0
0
1
1
0
0
1
0
0
0
0
1
0
0
0
1
1
0
0
0
0
1
0
1
0
0
1
0
0
1
0
0
0
0
0
0
1
0
0
1
1
0
0
0
1
0
1
0
0
1
0
1
0
1
0
1
1
0
0
0
0
1
0
0
0
0
1
0
0
1
0
0
0
1
...

result:

ok 500000 tokens

Test #19:

score: 0
Accepted
time: 123ms
memory: 140700kb

input:

0 5000 500000
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaadaaaaadaaaaadaaaaaaaaaaaaaaaaaaddaaaaaaaaadaaaaaaaaaddaaddaaaaaaaaad
rrwwwwwqnhnhhhuhhuppppuhuuwuuuuwuduzzuuuzzmxmtmmoaaojrneenneeeeeyqyeyvkkilhyyybzzzbiiibmbsvfvvfvlvvj
uukkkkkwfcfcccgccgaaaagcggdggggdgrgmmgggmmwlwkwwgzzgtvjbbjjbbbbbtqtbtriiwyadddcooocy...

output:

1
0
0
0
1
0
1
0
0
1
0
0
0
0
1
1
0
0
0
0
0
0
0
1
1
0
0
0
1
0
0
0
0
0
0
1
1
0
0
0
0
0
1
1
0
0
1
1
1
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
1
1
0
0
0
1
1
1
1
0
1
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
1
0
1
1
0
0
0
0
0
0
0
0
1
...

result:

ok 500000 tokens

Test #20:

score: 0
Accepted
time: 118ms
memory: 149336kb

input:

0 500 500000
llllllllllllllllnmnnnnmnnnnmnlllllllnnllnnbnnlllnnbbnnbnnbbnnnbbnnbnnbbbnnbbbnynbnbbnbnbbtbbtbbnbbtbbttbttbbtbbttbttbxxbtttbxkxkkxkxkkxkkxkxkxxkkxaxaaakkakkakkaakkkaakkkaaaakkkkaaaakkkaakkkakkkaakaaaaaakkakkaaakkakkaakkakkaakaakkakakakakkaakakakaiiakkkakalakakkkakalakkalaalhlallaalllaal...

output:

0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
...

result:

ok 500000 tokens

Test #21:

score: 0
Accepted
time: 106ms
memory: 142792kb

input:

0 20 500000
hhzhhhhzhhhhxhhggpgggpgollooooomrmmrbrmjjiijjijijijijjjhhhjjhjwwjhhbbhhhhbpswswswswadadaaddlddaqqaooooarajzjzjajzjzjjzzjzjzjjjzzjaaoahfmqmihhhhimmihhiiooiihhghvhhvvevevevvkkkvvdiddpdejjggsshsbssszszszvpkykkkbbkkhvhhhvhvkkmccccccjjcjyjjyyfynyfxxfxffxffbjnnzlzznnllnlnprddlzfzlzzzzzkkkklalq...

output:

0
0
1
1
0
0
0
0
0
1
0
0
0
1
0
1
1
1
0
1
0
0
1
0
0
0
0
1
0
0
0
1
1
1
0
0
0
0
1
1
0
0
1
1
1
0
1
0
0
0
1
1
1
1
0
0
1
0
1
1
1
1
0
0
1
0
1
0
1
1
0
0
1
0
1
1
0
1
0
0
1
1
1
1
0
1
1
0
0
0
0
0
0
1
1
1
0
0
0
0
1
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
1
1
1
1
0
0
1
1
1
0
1
1
0
1
1
0
1
1
0
1
0
0
0
0
1
0
1
1
1
1
0
0
0
1
...

result:

ok 500000 tokens

Test #22:

score: 0
Accepted
time: 93ms
memory: 142332kb

input:

0 5 500000
ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt...

output:

0
0
1
1
1
1
1
0
1
1
1
1
0
1
0
1
1
0
0
0
1
1
1
1
0
0
0
1
0
0
1
1
0
0
1
0
0
1
0
1
0
1
1
1
0
0
0
1
1
1
0
1
1
1
0
1
1
1
1
0
1
1
0
1
1
1
1
1
0
1
1
1
0
1
0
1
1
1
0
0
0
1
0
1
0
0
1
1
0
0
0
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
0
1
1
1
0
1
1
1
0
0
1
1
1
0
0
0
1
1
1
0
1
1
0
1
0
0
0
0
0
1
0
0
1
0
1
1
1
0
...

result:

ok 500000 tokens

Test #23:

score: 0
Accepted
time: 93ms
memory: 144588kb

input:

0 5 500000
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzpzzzzz...

output:

0
0
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
1
1
0
1
0
0
0
0
1
1
1
0
0
1
1
0
1
1
0
1
1
1
1
1
0
0
1
0
1
1
1
1
1
0
1
1
1
1
0
1
0
1
1
0
1
1
0
1
1
1
0
0
0
1
1
0
1
0
0
1
1
1
0
1
1
1
0
0
0
1
1
0
0
0
0
0
1
0
1
0
1
1
1
1
0
0
1
1
1
0
1
1
0
0
0
0
0
0
1
1
1
0
1
1
0
0
1
1
0
0
0
0
0
1
1
0
0
1
0
0
0
0
1
1
1
0
0
0
0
0
0
1
1
...

result:

ok 500000 tokens

Test #24:

score: 0
Accepted
time: 101ms
memory: 142660kb

input:

0 5 500000
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww...

output:

1
1
1
1
0
1
0
1
0
1
0
1
1
0
0
1
0
0
1
1
0
0
0
1
0
1
0
0
1
1
0
1
1
0
0
1
0
1
0
1
0
0
1
0
1
0
1
0
0
1
1
0
0
0
1
1
0
1
0
0
1
1
0
1
0
1
0
1
0
1
1
1
1
0
0
0
0
0
0
1
0
1
1
0
1
1
0
0
1
1
1
1
1
0
1
0
0
0
1
1
1
1
1
0
1
1
1
0
1
1
1
1
0
1
1
1
1
1
1
0
0
1
1
1
1
0
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
0
0
0
0
1
1
1
0
0
...

result:

ok 500000 tokens

Test #25:

score: 0
Accepted
time: 96ms
memory: 145012kb

input:

0 2 500000
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 500000 tokens

Test #26:

score: 0
Accepted
time: 96ms
memory: 144576kb

input:

0 2 500000
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 500000 tokens

Test #27:

score: 0
Accepted
time: 105ms
memory: 144072kb

input:

0 2 500000
sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 500000 tokens

Test #28:

score: 0
Accepted
time: 87ms
memory: 149792kb

input:

0 2 500000
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 500000 tokens

Test #29:

score: 0
Accepted
time: 106ms
memory: 150724kb

input:

0 2 500000
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 500000 tokens

Test #30:

score: 0
Accepted
time: 91ms
memory: 153856kb

input:

0 2 500000
uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 500000 tokens

Test #31:

score: 0
Accepted
time: 93ms
memory: 153792kb

input:

0 1 500000
ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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 500000 tokens

Subtask #3:

score: 20
Accepted

Test #32:

score: 20
Accepted
time: 59ms
memory: 146004kb

input:

0 1 1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1

result:

ok "1"

Test #33:

score: 0
Accepted
time: 48ms
memory: 135992kb

input:

0 2 1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

1

result:

ok "1"

Test #34:

score: 0
Accepted
time: 35ms
memory: 134004kb

input:

0 2 1
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

output:

300001

result:

ok "300001"

Test #35:

score: 0
Accepted
time: 39ms
memory: 139204kb

input:

0 2 1
bccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaa...

output:

33334

result:

ok "33334"

Test #36:

score: 0
Accepted
time: 44ms
memory: 144908kb

input:

0 2 1
bccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaabccbaa...

output:

100001

result:

ok "100001"

Test #37:

score: 0
Accepted
time: 47ms
memory: 135324kb

input:

0 2 1
bcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcdeedcbaabcde...

output:

20001

result:

ok "20001"

Test #38:

score: 0
Accepted
time: 35ms
memory: 144740kb

input:

0 100 1
a
j
w
z
m
h
d
n
f
c
k
z
f
c
m
d
v
o
e
w
t
r
j
j
e
l
q
q
m
y
a
a
q
g
i
e
y
p
k
x
c
q
t
b
c
r
l
n
e
t
x
d
x
w
a
a
p
g
e
v
x
o
r
v
e
n
t
s
t
x
u
y
l
x
bcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaabcddcbaa...

output:

74976

result:

ok "74976"

Test #39:

score: 0
Accepted
time: 39ms
memory: 140540kb

input:

0 2 1
epppipfhwh
wnybdiecccdcqdrdyrrrzrxizicvvvrvoxpxnpppspbnknmuuupuykckegggqgwctclhhhihvonooxxxrxwujuussswsxltlujjjpjxysyudddydrqeqozzzgznsislcccjcqlilyjgfxccctchvlvqfffhfvcpcyrrrqrstntomxvvvmvgprpawwwpwnjmjyjjjdjpbnbevvvovadmdrzzzpzothtekfffaflnwngkkkxkycncczzzgzsgvgldddjdnqmqyzzzbzwmhmmaaahawrvr...

output:

47042

result:

ok "47042"

Test #40:

score: 0
Accepted
time: 52ms
memory: 214808kb

input:

0 2 1
eoaxlzjsyyyysyyyysysyysyssysyysyssyysyyssysyssyyssysyssyysyyssyyssyysyyssyysssyyssyysyysssyysssysyysysssyyssavvhuqyhpetbpcplkobyavffffnffffnfnffnfnnfnffnfnnffnffnnfnfnnffnnfnfnnffnffnnffnnffnffnnffnnnffnnffnffnnnffnnnfnffnfnnnffnnbbbbsbbbbsbsbbsbssbsbbsbssbbsbbssbsbssbbssbsbssbbsbbssbbssbbsbbs...

output:

4748

result:

ok "4748"

Test #41:

score: 0
Accepted
time: 53ms
memory: 215524kb

input:

0 2 1
llllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll...

output:

13476

result:

ok "13476"

Test #42:

score: 0
Accepted
time: 63ms
memory: 214036kb

input:

0 2 1
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...

output:

47

result:

ok "47"

Test #43:

score: 0
Accepted
time: 55ms
memory: 217728kb

input:

0 2 1
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

4

result:

ok "4"

Test #44:

score: 0
Accepted
time: 41ms
memory: 132500kb

input:

0 3 1
bbbbabaaabbaaaaabbbbabbabaabbbaaabaababbbabbaababbaaaababbaabbbaabbbababbbbbbababaaababbbbaabaabbaaaabaaabaabaabbbabaabaabbbaaaabaabbabababbaabbaaaaaababbbbabbabbaabaaabaabbbbaababbaabababbaabaaabbaabababbaabaaaababababababbaaaababbbabbababbbabaaaabababbaaabbaaabababbaaaabaaababbbaabaabbababba...

output:

0

result:

ok "0"

Subtask #4:

score: 0
Skipped

Dependency #1:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%