UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#215004#2410. 图案fddwd60804ms9972kbC++11750b2024-11-25 19:42:522024-11-25 23:05:48

answer

#include<bits/stdc++.h>
using namespace std;
#define uint unsigned int
#define MAXN 1000010
int n,k;
string s;
uint pw[MAXN],vh[MAXN];
inline bool cmp(int l1,int r1,int l2,int r2){
	return (vh[r1]-vh[l1-1])*pw[n-r1]==(vh[r2]-vh[l2-1])*pw[n-r2];
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n>>k>>s;s=' '+s;
	pw[0]=1;for(int i=1;i<=n;++i) pw[i]=pw[i-1]*131;
	for(int i=1;i<=n;++i) vh[i]=vh[i-1]+(s[i]-'a'+1)*pw[i];
	for(int i=1;i<=n;++i){
		bool ff=false;
		for(int j=i%k;(i-j)/k>=j;j+=k)if(cmp(1,j,i-j+1,i)){
			bool flag=true;
			for(int p=(i-j)/k+1;p<=i-j;p+=(i-j)/k)
				if(!cmp(1,(i-j)/k,p,p+(i-j)/k-1)){flag=false;break;}
			if(flag){ff=true;break;}
		}cout<<ff;
	}cout<<endl;
	return 0;
}

详细

小提示:点击横条可展开更详细的信息

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 0ms
memory: 1272kb

input:

100 2
xxyxxyyxxyxxyypxxyxxyyxxyxxyypxxyxxyyxxyxxyypwxxyxxyyxxyxxyypxxyxxyyxxyxxyypxxyxxyyxxyxxyypwex...

output:

0100010000000100000000000000011111111111111110000000000000000000000000000000000000000000000100000000

result:

ok single line: '010001000000010000000000000001...0000000000000000000000100000000'

Test #2:

score: 0
Accepted
time: 0ms
memory: 1276kb

input:

100 3
xxxyxxxyxxxyyxxxyxxxyxxxyyxxxyxxxyxxxyypxxxyxxxyxxxyyxxxyxxxyxxxyyxxxyxxxyxxxyypxxxyxxxyxxxyyx...

output:

0010000000010000000000000000000000000010000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '001000000001000000000000000000...0000000000000000000000000000000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 1276kb

input:

100 2
baaaabbbaaabaabaaababbabaabbbabaaaabbababaaaabbaabbaaaababbaaabaaaaabbbbbaaaaabbbbbbaaabbaabaa...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #4:

score: 0
Accepted
time: 0ms
memory: 1276kb

input:

100 3
baaaabbbaaabaabaaababbabaabbbabaaaabbababaaaabbaabbaaaababbaaabaaaaabbbbbaaaaabbbbbbaaabbaabaa...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #5:

score: 0
Accepted
time: 0ms
memory: 1276kb

input:

100 15
xxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxx...

output:

0000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000001000000000000000...0000000000000000000000000000000'

Test #6:

score: 0
Accepted
time: 0ms
memory: 1276kb

input:

100 20
xxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxx...

output:

0000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000010000000000...0000000000000000000000000000000'

Test #7:

score: 0
Accepted
time: 0ms
memory: 1276kb

input:

100 7
xxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxx...

output:

0000001000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000

result:

ok single line: '000000100000000000000000000000...0000000000000000000000000000000'

Test #8:

score: 0
Accepted
time: 0ms
memory: 1272kb

input:

100 4
babbababaabababaabbaaabbbaaaaabaaababbbbaaaaabbbaabbbbaaabbbbabbaaaaaabababaabaababbbbabbbbbaa...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #9:

score: 0
Accepted
time: 0ms
memory: 1276kb

input:

100 5
kkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxskkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxskkkkkkxk...

output:

0000110000000000000000000000000000111111110000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000011000000000000000000000000...0000000000000000000000000000000'

Test #10:

score: 0
Accepted
time: 1ms
memory: 1272kb

input:

100 1
ggggvggggvoggggvggggvoggggvggggvocggggvggggvoggggvggggvoggggvggggvocjggggvggggvoggggvggggvoggg...

output:

1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #11:

score: 0
Accepted
time: 0ms
memory: 1272kb

input:

100 3
zshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshf...

output:

0000000000000000011111110000000000011111111111110000011111111111111111111111111111111111111111111111

result:

ok single line: '000000000000000001111111000000...1111111111111111111111111111111'

Test #12:

score: 0
Accepted
time: 0ms
memory: 1272kb

input:

100 12
fnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnj...

output:

0000000000000000000000000000000000011110000000000000000000000000000000011111110000000000000000000000

result:

ok single line: '000000000000000000000000000000...0011111110000000000000000000000'

Test #13:

score: 0
Accepted
time: 0ms
memory: 1272kb

input:

100 6
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...

output:

0000011000011100011110011111011111111111111111111111111111111111111111111111111111111111111111111111

result:

ok single line: '000001100001110001111001111101...1111111111111111111111111111111'

Subtask #2:

score: 20
Accepted

Test #14:

score: 20
Accepted
time: 0ms
memory: 1272kb

input:

100 2
xxyxxyyxxyxxyypxxyxxyyxxyxxyypxxyxxyyxxyxxyypwxxyxxyyxxyxxyypxxyxxyyxxyxxyypxxyxxyyxxyxxyypwex...

output:

0100010000000100000000000000011111111111111110000000000000000000000000000000000000000000000100000000

result:

ok single line: '010001000000010000000000000001...0000000000000000000000100000000'

Test #15:

score: 0
Accepted
time: 0ms
memory: 1276kb

input:

100 3
xxxyxxxyxxxyyxxxyxxxyxxxyyxxxyxxxyxxxyypxxxyxxxyxxxyyxxxyxxxyxxxyyxxxyxxxyxxxyypxxxyxxxyxxxyyx...

output:

0010000000010000000000000000000000000010000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '001000000001000000000000000000...0000000000000000000000000000000'

Test #16:

score: 0
Accepted
time: 0ms
memory: 1272kb

input:

100 2
baaaabbbaaabaabaaababbabaabbbabaaaabbababaaaabbaabbaaaababbaaabaaaaabbbbbaaaaabbbbbbaaabbaabaa...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #17:

score: 0
Accepted
time: 0ms
memory: 1272kb

input:

100 3
baaaabbbaaabaabaaababbabaabbbabaaaabbababaaaabbaabbaaaababbaaabaaaaabbbbbaaaaabbbbbbaaabbaabaa...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #18:

score: 0
Accepted
time: 0ms
memory: 1272kb

input:

100 15
xxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxx...

output:

0000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000001000000000000000...0000000000000000000000000000000'

Test #19:

score: 0
Accepted
time: 0ms
memory: 1272kb

input:

100 20
xxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxx...

output:

0000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000010000000000...0000000000000000000000000000000'

Test #20:

score: 0
Accepted
time: 0ms
memory: 1272kb

input:

100 7
xxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxx...

output:

0000001000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000

result:

ok single line: '000000100000000000000000000000...0000000000000000000000000000000'

Test #21:

score: 0
Accepted
time: 0ms
memory: 1276kb

input:

100 4
babbababaabababaabbaaabbbaaaaabaaababbbbaaaaabbbaabbbbaaabbbbabbaaaaaabababaabaababbbbabbbbbaa...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #22:

score: 0
Accepted
time: 0ms
memory: 1276kb

input:

100 5
kkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxskkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxskkkkkkxk...

output:

0000110000000000000000000000000000111111110000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000011000000000000000000000000...0000000000000000000000000000000'

Test #23:

score: 0
Accepted
time: 0ms
memory: 1272kb

input:

100 1
ggggvggggvoggggvggggvoggggvggggvocggggvggggvoggggvggggvoggggvggggvocjggggvggggvoggggvggggvoggg...

output:

1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #24:

score: 0
Accepted
time: 0ms
memory: 1276kb

input:

100 3
zshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshf...

output:

0000000000000000011111110000000000011111111111110000011111111111111111111111111111111111111111111111

result:

ok single line: '000000000000000001111111000000...1111111111111111111111111111111'

Test #25:

score: 0
Accepted
time: 0ms
memory: 1276kb

input:

100 12
fnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnj...

output:

0000000000000000000000000000000000011110000000000000000000000000000000011111110000000000000000000000

result:

ok single line: '000000000000000000000000000000...0011111110000000000000000000000'

Test #26:

score: 0
Accepted
time: 0ms
memory: 1272kb

input:

100 6
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...

output:

0000011000011100011110011111011111111111111111111111111111111111111111111111111111111111111111111111

result:

ok single line: '000001100001110001111001111101...1111111111111111111111111111111'

Test #27:

score: 0
Accepted
time: 0ms
memory: 1300kb

input:

2500 5
yyyyymyyyyymyyyyymyyyyymyyyyymwyyyyymyyyyymyyyyymyyyyymyyyyymwyyyyymyyyyymyyyyymyyyyymyyyyymw...

output:

0000100000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000010000000000000000000000001...0000000000000000000000000000000'

Test #28:

score: 0
Accepted
time: 3ms
memory: 1296kb

input:

2500 2
bbbbbgbbbbbgfbbbbbgbbbbbgfbbbbbgbbbbbgfwbbbbbgbbbbbgfbbbbbgbbbbbgfbbbbbgbbbbbgfwzbbbbbgbbbbbg...

output:

0111100000010000000000000111111111111110000000000000000000000000000000000000000100000000000000000000...

result:

ok single line: '011110000001000000000000011111...0000000000000000000000000000000'

Test #29:

score: 0
Accepted
time: 1ms
memory: 1296kb

input:

2500 1
oodvoodvuoodvoodvuuoodvoodvuoodvoodvuuloodvoodvuoodvoodvuuoodvoodvuoodvoodvuulwfguuoodvoodvuo...

output:

1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #30:

score: 0
Accepted
time: 0ms
memory: 1300kb

input:

2500 7
vvvvvvvcvvvvvvvcvvvvvvvcvvvvvvvcvvvvvvvcvvvvvvvcvvvvvvvcvvvvvvvclvvvvvvvcvvvvvvvcvvvvvvvcvvvv...

output:

0000001000000000000000000000000000000000000000000000000111111111000000000000000000000000000000000000...

result:

ok single line: '000000100000000000000000000000...0000000000000000000000000000000'

Test #31:

score: 0
Accepted
time: 0ms
memory: 1296kb

input:

2500 130
lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #32:

score: 0
Accepted
time: 1ms
memory: 1296kb

input:

2500 2
bbaabaaaaabaabbbaabaabbaabaaaaabbababaabaabababbaabaaaaaaaaabbbabbbabbbbbabaaabaaaaabbabbbbaa...

output:

0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '010000000000000000000000000000...0000000000000000000000000000000'

Test #33:

score: 0
Accepted
time: 3ms
memory: 1296kb

input:

2500 2
abaaaaabbabbaabbbaabaaababaabbbbabbbbbaabbaabbbbaaaaabbaabbbaaabbbaaaaabbabbabaabaabbbbbaaaaa...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #34:

score: 0
Accepted
time: 3ms
memory: 1300kb

input:

2500 2
aaabbaaababbaababbbbaaabaaabbbbbbbbbbbbababbbaaabbbabbbbaaabbbbaaabbbabbbaaabaaabbaabaabaaaba...

output:

0110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '011000000000000000000000000000...0000000000000000000000000000000'

Test #35:

score: 0
Accepted
time: 2ms
memory: 1300kb

input:

2500 3
bbaaababbaaabbbbaaabbabaaabbbbaabaabbaaababaaaaaaabbaaabbbaaaaababaabbaabbbbbbbbbababbbaabaaa...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #36:

score: 0
Accepted
time: 2ms
memory: 1300kb

input:

2500 3
abaaaaabbbbabbbababbbbababaabbbaababaaabbbbbaabbababaabbbbbbbabbbbabbaabbbababbaababababababb...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #37:

score: 0
Accepted
time: 0ms
memory: 1300kb

input:

2500 4
aaabbabbbbbabaababbbaaabbaabaaaaaabbaaabbbabbaaaaabaababbaabaabbbaababbaabbabbabbbabaaababaab...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #38:

score: 0
Accepted
time: 0ms
memory: 1300kb

input:

2500 4
aaaabababbaaaaabbaaaaabaaabaabbbbbbbbabbbbbbaabbabbbbbbbbbbaaabbaaabbbaabaababaaaababbbaabaab...

output:

0001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000100000000000000000000000000...0000000000000000000000000000000'

Test #39:

score: 0
Accepted
time: 2ms
memory: 1296kb

input:

2500 4
abbbbbbaaaaaaabaaaabbbaaababaaabbbabaabbabbabaaaaabaabaababbabaaabbababbbababbabbbbbbbbaaabab...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #40:

score: 0
Accepted
time: 1ms
memory: 1296kb

input:

2500 5
ababaaaabbaabaaaaaabbabaaaaababbbbbbbbbbbbbabbabbbaabaababbababababbaaababbbabbbababbababaaab...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #41:

score: 0
Accepted
time: 2ms
memory: 1300kb

input:

2500 5
bbbbbbabaabbbaabbbbababaabaababababbbaaaabbbbbaabaaaabaaabaabbabaaabaabababbabbbbababbaaabaaa...

output:

0000110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000011000000000000000000000000...0000000000000000000000000000000'

Test #42:

score: 0
Accepted
time: 0ms
memory: 1300kb

input:

2500 5
aabbbbbbbbaaaabbbabbbbaaaaaaabbaaaabababbabbaaabbbaaabbbbbbabaabbaabaaababaaabbbabbbaaaaababb...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #43:

score: 0
Accepted
time: 0ms
memory: 1300kb

input:

2500 5
dwjefaogypcifqefxzcfxtvqvvjkflxikhophfxhuzqzpwgnvjuuepmakwmrhjbtssicxfjrhbtwzzlwkftrufthbfyjq...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000001'

Test #44:

score: 0
Accepted
time: 0ms
memory: 1296kb

input:

2500 3
curquntzziruhtdmourgoccecnpspbervwirjdqiokexdhjrcazqecwhrnzgofzmbjdmpuxdgballldpnehrieyztzhkf...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #45:

score: 0
Accepted
time: 1ms
memory: 1300kb

input:

2500 33
acvjpngvaacvjpngvaacvjpngvaacvjpngvaacvjpngvaacvjpngvaacvjpngvaacvjpngvaacvjpngvaacvjpngvaac...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #46:

score: 0
Accepted
time: 0ms
memory: 1296kb

input:

2500 18
wkjlqeeipdpfiwkjlqeeipdpfiwkjlqeeipdpfiwkjlqeeipdpfiwkjlqeeipdpfiwkjlqeeipdpfiwkjlqeeipdpfiw...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...1000000000000000000000000000000'

Test #47:

score: 0
Accepted
time: 0ms
memory: 1300kb

input:

2500 140
qplkexfqwzufbcqplkexfqwzufbcqplkexfqwzufbcqplkexfqwzufbcqplkexfqwzufbcqplkexfqwzufbcqplkexf...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #48:

score: 0
Accepted
time: 0ms
memory: 1300kb

input:

2500 420
bkuywbkuywbkuywbkuywbkuywbkuywbkuywbkuywbkuywbkuywbkuywbkuywbkuywbkuywbkuywbkuywbkuywbkuywb...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #49:

score: 0
Accepted
time: 0ms
memory: 1300kb

input:

2500 650
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #50:

score: 0
Accepted
time: 0ms
memory: 1300kb

input:

2500 800
dododododododododododododododododododododododododododododododododododododododododododododod...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Subtask #3:

score: 20
Accepted

Test #51:

score: 20
Accepted
time: 104ms
memory: 9972kb

input:

1000000 23
cicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicic...

output:

0000000000000000000000000000000000000000000001110000000000000000000000000000000000000000000111110000...

result:

ok single line: '000000000000000000000000000000...1111111111111111111111111111111'

Test #52:

score: 0
Accepted
time: 68ms
memory: 3112kb

input:

200000 200
twtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwt...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...1111111111111111111111111111111'

Test #53:

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

input:

200000 500
grgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrg...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000001'

Test #54:

score: 0
Accepted
time: 68ms
memory: 9968kb

input:

1000000 61445
jdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjd...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #55:

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

input:

1000000 321758
zmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmz...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #56:

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

input:

1000000 499999
vxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxv...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000111'

Subtask #4:

score: 0
Time Limit Exceeded

Test #57:

score: 40
Accepted
time: 0ms
memory: 1272kb

input:

100 2
xxyxxyyxxyxxyypxxyxxyyxxyxxyypxxyxxyyxxyxxyypwxxyxxyyxxyxxyypxxyxxyyxxyxxyypxxyxxyyxxyxxyypwex...

output:

0100010000000100000000000000011111111111111110000000000000000000000000000000000000000000000100000000

result:

ok single line: '010001000000010000000000000001...0000000000000000000000100000000'

Test #58:

score: 0
Accepted
time: 1ms
memory: 1276kb

input:

100 3
xxxyxxxyxxxyyxxxyxxxyxxxyyxxxyxxxyxxxyypxxxyxxxyxxxyyxxxyxxxyxxxyyxxxyxxxyxxxyypxxxyxxxyxxxyyx...

output:

0010000000010000000000000000000000000010000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '001000000001000000000000000000...0000000000000000000000000000000'

Test #59:

score: 0
Accepted
time: 0ms
memory: 1272kb

input:

100 2
baaaabbbaaabaabaaababbabaabbbabaaaabbababaaaabbaabbaaaababbaaabaaaaabbbbbaaaaabbbbbbaaabbaabaa...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #60:

score: 0
Accepted
time: 0ms
memory: 1276kb

input:

100 3
baaaabbbaaabaabaaababbabaabbbabaaaabbababaaaabbaabbaaaababbaaabaaaaabbbbbaaaaabbbbbbaaabbaabaa...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #61:

score: 0
Accepted
time: 0ms
memory: 1272kb

input:

100 15
xxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxx...

output:

0000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000001000000000000000...0000000000000000000000000000000'

Test #62:

score: 0
Accepted
time: 0ms
memory: 1276kb

input:

100 20
xxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxx...

output:

0000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000010000000000...0000000000000000000000000000000'

Test #63:

score: 0
Accepted
time: 1ms
memory: 1276kb

input:

100 7
xxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxx...

output:

0000001000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000

result:

ok single line: '000000100000000000000000000000...0000000000000000000000000000000'

Test #64:

score: 0
Accepted
time: 0ms
memory: 1276kb

input:

100 4
babbababaabababaabbaaabbbaaaaabaaababbbbaaaaabbbaabbbbaaabbbbabbaaaaaabababaabaababbbbabbbbbaa...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #65:

score: 0
Accepted
time: 1ms
memory: 1276kb

input:

100 5
kkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxskkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxskkkkkkxk...

output:

0000110000000000000000000000000000111111110000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000011000000000000000000000000...0000000000000000000000000000000'

Test #66:

score: 0
Accepted
time: 0ms
memory: 1272kb

input:

100 1
ggggvggggvoggggvggggvoggggvggggvocggggvggggvoggggvggggvoggggvggggvocjggggvggggvoggggvggggvoggg...

output:

1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #67:

score: 0
Accepted
time: 0ms
memory: 1272kb

input:

100 3
zshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshf...

output:

0000000000000000011111110000000000011111111111110000011111111111111111111111111111111111111111111111

result:

ok single line: '000000000000000001111111000000...1111111111111111111111111111111'

Test #68:

score: 0
Accepted
time: 0ms
memory: 1272kb

input:

100 12
fnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnj...

output:

0000000000000000000000000000000000011110000000000000000000000000000000011111110000000000000000000000

result:

ok single line: '000000000000000000000000000000...0011111110000000000000000000000'

Test #69:

score: 0
Accepted
time: 0ms
memory: 1272kb

input:

100 6
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...

output:

0000011000011100011110011111011111111111111111111111111111111111111111111111111111111111111111111111

result:

ok single line: '000001100001110001111001111101...1111111111111111111111111111111'

Test #70:

score: 0
Accepted
time: 1ms
memory: 1296kb

input:

2500 5
yyyyymyyyyymyyyyymyyyyymyyyyymwyyyyymyyyyymyyyyymyyyyymyyyyymwyyyyymyyyyymyyyyymyyyyymyyyyymw...

output:

0000100000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000010000000000000000000000001...0000000000000000000000000000000'

Test #71:

score: 0
Accepted
time: 3ms
memory: 1300kb

input:

2500 2
bbbbbgbbbbbgfbbbbbgbbbbbgfbbbbbgbbbbbgfwbbbbbgbbbbbgfbbbbbgbbbbbgfbbbbbgbbbbbgfwzbbbbbgbbbbbg...

output:

0111100000010000000000000111111111111110000000000000000000000000000000000000000100000000000000000000...

result:

ok single line: '011110000001000000000000011111...0000000000000000000000000000000'

Test #72:

score: 0
Accepted
time: 0ms
memory: 1296kb

input:

2500 1
oodvoodvuoodvoodvuuoodvoodvuoodvoodvuuloodvoodvuoodvoodvuuoodvoodvuoodvoodvuulwfguuoodvoodvuo...

output:

1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #73:

score: 0
Accepted
time: 0ms
memory: 1300kb

input:

2500 7
vvvvvvvcvvvvvvvcvvvvvvvcvvvvvvvcvvvvvvvcvvvvvvvcvvvvvvvcvvvvvvvclvvvvvvvcvvvvvvvcvvvvvvvcvvvv...

output:

0000001000000000000000000000000000000000000000000000000111111111000000000000000000000000000000000000...

result:

ok single line: '000000100000000000000000000000...0000000000000000000000000000000'

Test #74:

score: 0
Accepted
time: 0ms
memory: 1300kb

input:

2500 130
lllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #75:

score: 0
Accepted
time: 1ms
memory: 1300kb

input:

2500 2
bbaabaaaaabaabbbaabaabbaabaaaaabbababaabaabababbaabaaaaaaaaabbbabbbabbbbbabaaabaaaaabbabbbbaa...

output:

0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '010000000000000000000000000000...0000000000000000000000000000000'

Test #76:

score: 0
Accepted
time: 3ms
memory: 1296kb

input:

2500 2
abaaaaabbabbaabbbaabaaababaabbbbabbbbbaabbaabbbbaaaaabbaabbbaaabbbaaaaabbabbabaabaabbbbbaaaaa...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #77:

score: 0
Accepted
time: 3ms
memory: 1300kb

input:

2500 2
aaabbaaababbaababbbbaaabaaabbbbbbbbbbbbababbbaaabbbabbbbaaabbbbaaabbbabbbaaabaaabbaabaabaaaba...

output:

0110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '011000000000000000000000000000...0000000000000000000000000000000'

Test #78:

score: 0
Accepted
time: 0ms
memory: 1296kb

input:

2500 3
bbaaababbaaabbbbaaabbabaaabbbbaabaabbaaababaaaaaaabbaaabbbaaaaababaabbaabbbbbbbbbababbbaabaaa...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #79:

score: 0
Accepted
time: 0ms
memory: 1296kb

input:

2500 3
abaaaaabbbbabbbababbbbababaabbbaababaaabbbbbaabbababaabbbbbbbabbbbabbaabbbababbaababababababb...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #80:

score: 0
Accepted
time: 0ms
memory: 1296kb

input:

2500 4
aaabbabbbbbabaababbbaaabbaabaaaaaabbaaabbbabbaaaaabaababbaabaabbbaababbaabbabbabbbabaaababaab...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #81:

score: 0
Accepted
time: 0ms
memory: 1296kb

input:

2500 4
aaaabababbaaaaabbaaaaabaaabaabbbbbbbbabbbbbbaabbabbbbbbbbbbaaabbaaabbbaabaababaaaababbbaabaab...

output:

0001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000100000000000000000000000000...0000000000000000000000000000000'

Test #82:

score: 0
Accepted
time: 0ms
memory: 1296kb

input:

2500 4
abbbbbbaaaaaaabaaaabbbaaababaaabbbabaabbabbabaaaaabaabaababbabaaabbababbbababbabbbbbbbbaaabab...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #83:

score: 0
Accepted
time: 0ms
memory: 1296kb

input:

2500 5
ababaaaabbaabaaaaaabbabaaaaababbbbbbbbbbbbbabbabbbaabaababbababababbaaababbbabbbababbababaaab...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #84:

score: 0
Accepted
time: 0ms
memory: 1296kb

input:

2500 5
bbbbbbabaabbbaabbbbababaabaababababbbaaaabbbbbaabaaaabaaabaabbabaaabaabababbabbbbababbaaabaaa...

output:

0000110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000011000000000000000000000000...0000000000000000000000000000000'

Test #85:

score: 0
Accepted
time: 0ms
memory: 1296kb

input:

2500 5
aabbbbbbbbaaaabbbabbbbaaaaaaabbaaaabababbabbaaabbbaaabbbbbbabaabbaabaaababaaabbbabbbaaaaababb...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #86:

score: 0
Accepted
time: 1ms
memory: 1300kb

input:

2500 5
dwjefaogypcifqefxzcfxtvqvvjkflxikhophfxhuzqzpwgnvjuuepmakwmrhjbtssicxfjrhbtwzzlwkftrufthbfyjq...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000001'

Test #87:

score: 0
Accepted
time: 2ms
memory: 1300kb

input:

2500 3
curquntzziruhtdmourgoccecnpspbervwirjdqiokexdhjrcazqecwhrnzgofzmbjdmpuxdgballldpnehrieyztzhkf...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #88:

score: 0
Accepted
time: 0ms
memory: 1296kb

input:

2500 33
acvjpngvaacvjpngvaacvjpngvaacvjpngvaacvjpngvaacvjpngvaacvjpngvaacvjpngvaacvjpngvaacvjpngvaac...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #89:

score: 0
Accepted
time: 0ms
memory: 1300kb

input:

2500 18
wkjlqeeipdpfiwkjlqeeipdpfiwkjlqeeipdpfiwkjlqeeipdpfiwkjlqeeipdpfiwkjlqeeipdpfiwkjlqeeipdpfiw...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...1000000000000000000000000000000'

Test #90:

score: 0
Accepted
time: 0ms
memory: 1296kb

input:

2500 140
qplkexfqwzufbcqplkexfqwzufbcqplkexfqwzufbcqplkexfqwzufbcqplkexfqwzufbcqplkexfqwzufbcqplkexf...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #91:

score: 0
Accepted
time: 0ms
memory: 1300kb

input:

2500 420
bkuywbkuywbkuywbkuywbkuywbkuywbkuywbkuywbkuywbkuywbkuywbkuywbkuywbkuywbkuywbkuywbkuywbkuywb...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #92:

score: 0
Accepted
time: 0ms
memory: 1296kb

input:

2500 650
eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #93:

score: 0
Accepted
time: 0ms
memory: 1296kb

input:

2500 800
dododododododododododododododododododododododododododododododododododododododododododododod...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #94:

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

input:

1000000 23
cicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicic...

output:

0000000000000000000000000000000000000000000001110000000000000000000000000000000000000000000111110000...

result:

ok single line: '000000000000000000000000000000...1111111111111111111111111111111'

Test #95:

score: 0
Accepted
time: 64ms
memory: 3116kb

input:

200000 200
twtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwtwt...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...1111111111111111111111111111111'

Test #96:

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

input:

200000 500
grgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrgrg...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000001'

Test #97:

score: 0
Accepted
time: 50ms
memory: 9972kb

input:

1000000 61445
jdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjdjd...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #98:

score: 0
Accepted
time: 56ms
memory: 9968kb

input:

1000000 321758
zmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmzmz...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #99:

score: 0
Accepted
time: 54ms
memory: 9968kb

input:

1000000 499999
vxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxvxv...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000111'

Test #100:

score: -40
Time Limit Exceeded

input:

300000 3
aaauaaauaaaukaaauaaauaaaukaaauaaauaaaukaaauaaauaaaukaaaauaaauaaaukaaauaaauaaaukaaauaaauaaau...

output:

0010000000010000000000000000000000000011111111111111000000000000000000000000000000000000000000000000...

result: