ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#214983 | #2410. 图案 | nodgd | 0 | 18ms | 7048kb | C++11 | 552b | 2024-11-25 19:12:00 | 2024-11-25 23:01:50 |
answer
#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1000000 + 5;
int N, K;
char s[MAX_N], ans[MAX_N];
int f[MAX_N];
int main() {
scanf("%d%d", &N, &K);
scanf("%s", s + 1);
f[1] = 0, ans[1] = K == 1 ? '1' : '0';
for (int i = 2, j = 0; i <= N; i ++) {
for (; j >= 1 && s[i] != s[j + 1]; j = f[j]);
f[i] = j += s[i] == s[j + 1];
int t = i - f[i], c = i / t;
ans[i] = '0' + (c % K == 0 || i % t == 0 && c % (K + 1) == 0);
}
printf("%s", ans + 1);
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 20
Accepted
time: 0ms
memory: 1204kb
input:
100 2 xxyxxyyxxyxxyypxxyxxyyxxyxxyypxxyxxyyxxyxxyypwxxyxxyyxxyxxyypxxyxxyyxxyxxyypxxyxxyyxxyxxyypwex...
output:
0100010000000100000000000000011111111111111110000000000000000000000000000000000000000000000100000000
result:
ok single line: '010001000000010000000000000001...0000000000000000000000100000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 1204kb
input:
100 3 xxxyxxxyxxxyyxxxyxxxyxxxyyxxxyxxxyxxxyypxxxyxxxyxxxyyxxxyxxxyxxxyyxxxyxxxyxxxyypxxxyxxxyxxxyyx...
output:
0010000000010000000000000000000000000010000000000000000000000000000000000000000000000000000000000000
result:
ok single line: '001000000001000000000000000000...0000000000000000000000000000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 1204kb
input:
100 2 baaaabbbaaabaabaaababbabaabbbabaaaabbababaaaabbaabbaaaababbaaabaaaaabbbbbaaaaabbbbbbaaabbaabaa...
output:
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 1204kb
input:
100 3 baaaabbbaaabaabaaababbabaabbbabaaaabbababaaaabbaabbaaaababbaaabaaaaabbbbbaaaaabbbbbbaaabbaabaa...
output:
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 1204kb
input:
100 15 xxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxx...
output:
0000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000
result:
ok single line: '000000000000001000000000000000...0000000000000000000000000000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 1200kb
input:
100 20 xxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxx...
output:
0000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000
result:
ok single line: '000000000000000000010000000000...0000000000000000000000000000000'
Test #7:
score: 0
Accepted
time: 0ms
memory: 1200kb
input:
100 7 xxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxx...
output:
0000001000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000
result:
ok single line: '000000100000000000000000000000...0000000000000000000000000000000'
Test #8:
score: 0
Accepted
time: 0ms
memory: 1200kb
input:
100 4 babbababaabababaabbaaabbbaaaaabaaababbbbaaaaabbbaabbbbaaabbbbabbaaaaaabababaabaababbbbabbbbbaa...
output:
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #9:
score: 0
Accepted
time: 0ms
memory: 1204kb
input:
100 5 kkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxskkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxskkkkkkxk...
output:
0000110000000000000000000000000000111111110000000000000000000000000000000000000000000000000000000000
result:
ok single line: '000011000000000000000000000000...0000000000000000000000000000000'
Test #10:
score: 0
Accepted
time: 0ms
memory: 1204kb
input:
100 1 ggggvggggvoggggvggggvoggggvggggvocggggvggggvoggggvggggvoggggvggggvocjggggvggggvoggggvggggvoggg...
output:
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
result:
ok single line: '111111111111111111111111111111...1111111111111111111111111111111'
Test #11:
score: -20
Wrong Answer
time: 1ms
memory: 1200kb
input:
100 3 zshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshf...
output:
0000000000000000011111110000000000011111100000010000011111100000000000011111100000000000011111110000
result:
wrong answer 1st lines differ - expected: '000000000000000001111111000000...111111111111111111111111...
Subtask #2:
score: 0
Wrong Answer
Test #14:
score: 20
Accepted
time: 0ms
memory: 1200kb
input:
100 2 xxyxxyyxxyxxyypxxyxxyyxxyxxyypxxyxxyyxxyxxyypwxxyxxyyxxyxxyypxxyxxyyxxyxxyypxxyxxyyxxyxxyypwex...
output:
0100010000000100000000000000011111111111111110000000000000000000000000000000000000000000000100000000
result:
ok single line: '010001000000010000000000000001...0000000000000000000000100000000'
Test #15:
score: 0
Accepted
time: 0ms
memory: 1200kb
input:
100 3 xxxyxxxyxxxyyxxxyxxxyxxxyyxxxyxxxyxxxyypxxxyxxxyxxxyyxxxyxxxyxxxyyxxxyxxxyxxxyypxxxyxxxyxxxyyx...
output:
0010000000010000000000000000000000000010000000000000000000000000000000000000000000000000000000000000
result:
ok single line: '001000000001000000000000000000...0000000000000000000000000000000'
Test #16:
score: 0
Accepted
time: 1ms
memory: 1200kb
input:
100 2 baaaabbbaaabaabaaababbabaabbbabaaaabbababaaaabbaabbaaaababbaaabaaaaabbbbbaaaaabbbbbbaaabbaabaa...
output:
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #17:
score: 0
Accepted
time: 0ms
memory: 1204kb
input:
100 3 baaaabbbaaabaabaaababbabaabbbabaaaabbababaaaabbaabbaaaababbaaabaaaaabbbbbaaaaabbbbbbaaabbaabaa...
output:
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #18:
score: 0
Accepted
time: 1ms
memory: 1200kb
input:
100 15 xxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxx...
output:
0000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000
result:
ok single line: '000000000000001000000000000000...0000000000000000000000000000000'
Test #19:
score: 0
Accepted
time: 0ms
memory: 1204kb
input:
100 20 xxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxx...
output:
0000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000
result:
ok single line: '000000000000000000010000000000...0000000000000000000000000000000'
Test #20:
score: 0
Accepted
time: 0ms
memory: 1204kb
input:
100 7 xxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxx...
output:
0000001000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000
result:
ok single line: '000000100000000000000000000000...0000000000000000000000000000000'
Test #21:
score: 0
Accepted
time: 0ms
memory: 1200kb
input:
100 4 babbababaabababaabbaaabbbaaaaabaaababbbbaaaaabbbaabbbbaaabbbbabbaaaaaabababaabaababbbbabbbbbaa...
output:
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #22:
score: 0
Accepted
time: 0ms
memory: 1204kb
input:
100 5 kkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxskkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxskkkkkkxk...
output:
0000110000000000000000000000000000111111110000000000000000000000000000000000000000000000000000000000
result:
ok single line: '000011000000000000000000000000...0000000000000000000000000000000'
Test #23:
score: 0
Accepted
time: 0ms
memory: 1204kb
input:
100 1 ggggvggggvoggggvggggvoggggvggggvocggggvggggvoggggvggggvoggggvggggvocjggggvggggvoggggvggggvoggg...
output:
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
result:
ok single line: '111111111111111111111111111111...1111111111111111111111111111111'
Test #24:
score: -20
Wrong Answer
time: 0ms
memory: 1200kb
input:
100 3 zshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshf...
output:
0000000000000000011111110000000000011111100000010000011111100000000000011111100000000000011111110000
result:
wrong answer 1st lines differ - expected: '000000000000000001111111000000...111111111111111111111111...
Subtask #3:
score: 0
Wrong Answer
Test #51:
score: 0
Wrong Answer
time: 14ms
memory: 7048kb
input:
1000000 23 cicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicic...
output:
0000000000000000000000000000000000000000000001110000000000000000000000000000000000000000000110010000...
result:
wrong answer 1st lines differ - expected: '000000000000000000000000000000...111111111111111111111111...
Subtask #4:
score: 0
Wrong Answer
Test #57:
score: 40
Accepted
time: 0ms
memory: 1200kb
input:
100 2 xxyxxyyxxyxxyypxxyxxyyxxyxxyypxxyxxyyxxyxxyypwxxyxxyyxxyxxyypxxyxxyyxxyxxyypxxyxxyyxxyxxyypwex...
output:
0100010000000100000000000000011111111111111110000000000000000000000000000000000000000000000100000000
result:
ok single line: '010001000000010000000000000001...0000000000000000000000100000000'
Test #58:
score: 0
Accepted
time: 0ms
memory: 1200kb
input:
100 3 xxxyxxxyxxxyyxxxyxxxyxxxyyxxxyxxxyxxxyypxxxyxxxyxxxyyxxxyxxxyxxxyyxxxyxxxyxxxyypxxxyxxxyxxxyyx...
output:
0010000000010000000000000000000000000010000000000000000000000000000000000000000000000000000000000000
result:
ok single line: '001000000001000000000000000000...0000000000000000000000000000000'
Test #59:
score: 0
Accepted
time: 0ms
memory: 1204kb
input:
100 2 baaaabbbaaabaabaaababbabaabbbabaaaabbababaaaabbaabbaaaababbaaabaaaaabbbbbaaaaabbbbbbaaabbaabaa...
output:
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #60:
score: 0
Accepted
time: 0ms
memory: 1204kb
input:
100 3 baaaabbbaaabaabaaababbabaabbbabaaaabbababaaaabbaabbaaaababbaaabaaaaabbbbbaaaaabbbbbbaaabbaabaa...
output:
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #61:
score: 0
Accepted
time: 0ms
memory: 1200kb
input:
100 15 xxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxx...
output:
0000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000
result:
ok single line: '000000000000001000000000000000...0000000000000000000000000000000'
Test #62:
score: 0
Accepted
time: 0ms
memory: 1200kb
input:
100 20 xxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxx...
output:
0000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000
result:
ok single line: '000000000000000000010000000000...0000000000000000000000000000000'
Test #63:
score: 0
Accepted
time: 0ms
memory: 1200kb
input:
100 7 xxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxx...
output:
0000001000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000
result:
ok single line: '000000100000000000000000000000...0000000000000000000000000000000'
Test #64:
score: 0
Accepted
time: 1ms
memory: 1204kb
input:
100 4 babbababaabababaabbaaabbbaaaaabaaababbbbaaaaabbbaabbbbaaabbbbabbaaaaaabababaabaababbbbabbbbbaa...
output:
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
result:
ok single line: '000000000000000000000000000000...0000000000000000000000000000000'
Test #65:
score: 0
Accepted
time: 0ms
memory: 1204kb
input:
100 5 kkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxskkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxskkkkkkxk...
output:
0000110000000000000000000000000000111111110000000000000000000000000000000000000000000000000000000000
result:
ok single line: '000011000000000000000000000000...0000000000000000000000000000000'
Test #66:
score: 0
Accepted
time: 0ms
memory: 1200kb
input:
100 1 ggggvggggvoggggvggggvoggggvggggvocggggvggggvoggggvggggvoggggvggggvocjggggvggggvoggggvggggvoggg...
output:
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
result:
ok single line: '111111111111111111111111111111...1111111111111111111111111111111'
Test #67:
score: -40
Wrong Answer
time: 0ms
memory: 1200kb
input:
100 3 zshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshf...
output:
0000000000000000011111110000000000011111100000010000011111100000000000011111100000000000011111110000
result:
wrong answer 1st lines differ - expected: '000000000000000001111111000000...111111111111111111111111...