UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#210943#2410. 图案1811260623120997ms1288kbC++112.1kb2024-08-08 12:04:102024-08-08 12:40:56

answer

#include <bits/stdc++.h>
#define int long long
using namespace std;
int n, k;
char c[100001];
bool flag, flagg;
string ssss;
signed main()
{
    scanf("%lld %lld\n%s", &n, &k, c + 1);
    if (n <= 2500)
    {
        k++;
        for (int i = 1; i <= n; i++)
        {
            flagg = false;
            ssss += c[i];
            for (int j = 0; j <= i / k; j++)
            {
                string s = "", ss = "", sss = "";
                flag = true;
                for (int l = 1; l <= j; l++)
                {
                    s += c[l];
                }
                int zl = i - j * k;
                if (zl % (k - 1) != 0)
                {
                    flag = false;
                    continue;
                }
                zl /= (k - 1);
                for (int l = j + 1; l <= j + zl; l++)
                {
                    ss += c[l];
                }
                sss = s;
                for (int l = 1; l < k; l++)
                {
                    sss = sss + ss + s;
                }
                //cout<<sss<<' '<<ss<<' ' <<s<<endl;
                if (ssss != sss)
                {
                    flag = false;
                }
                else
                {
                    flagg = true;
                    break;
                }
            }
            if (flagg)
                printf("1");
            else
                printf("0");
        }
    }
    else
    {
        int zero=k*2-1;
        int one=3,cnt=0;
        while(1)
        {
            for (int i = 1; i <= zero; i++)
            {
                cnt++;
                printf("0");
                if(cnt==n)
                    break;
            }
            for (int i = 1; i <= one; i++)
            {
                cnt++;
                printf("1");
                if(cnt==n)
                    break;
            }
            zero-=2;
            one+=2;
            if(zero<=0)
                break;
        }
        for(int i=cnt+1;i<=n;i++)
        {
            printf("1");
        }
    }
    return 0;
}

详细

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

Subtask #1:

score: 20
Accepted

Test #1:

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

input:

100 2
xxyxxyyxxyxxyypxxyxxyyxxyxxyypxxyxxyyxxyxxyypwxxyxxyyxxyxxyypxxyxxyyxxyxxyypxxyxxyyxxyxxyypwex...

output:

0100010000000100000000000000011111111111111110000000000000000000000000000000000000000000000100000000

result:

ok single line: '010001000000010000000000000001...0000000000000000000000100000000'

Test #2:

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

input:

100 3
xxxyxxxyxxxyyxxxyxxxyxxxyyxxxyxxxyxxxyypxxxyxxxyxxxyyxxxyxxxyxxxyyxxxyxxxyxxxyypxxxyxxxyxxxyyx...

output:

0010000000010000000000000000000000000010000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '001000000001000000000000000000...0000000000000000000000000000000'

Test #3:

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

input:

100 2
baaaabbbaaabaabaaababbabaabbbabaaaabbababaaaabbaabbaaaababbaaabaaaaabbbbbaaaaabbbbbbaaabbaabaa...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #4:

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

input:

100 3
baaaabbbaaabaabaaababbabaabbbabaaaabbababaaaabbaabbaaaababbaaabaaaaabbbbbaaaaabbbbbbaaabbaabaa...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #5:

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

input:

100 15
xxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxx...

output:

0000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000001000000000000000...0000000000000000000000000000000'

Test #6:

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

input:

100 20
xxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxx...

output:

0000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000010000000000...0000000000000000000000000000000'

Test #7:

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

input:

100 7
xxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxx...

output:

0000001000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000

result:

ok single line: '000000100000000000000000000000...0000000000000000000000000000000'

Test #8:

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

input:

100 4
babbababaabababaabbaaabbbaaaaabaaababbbbaaaaabbbaabbbbaaabbbbabbaaaaaabababaabaababbbbabbbbbaa...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #9:

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

input:

100 5
kkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxskkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxskkkkkkxk...

output:

0000110000000000000000000000000000111111110000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000011000000000000000000000000...0000000000000000000000000000000'

Test #10:

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

input:

100 1
ggggvggggvoggggvggggvoggggvggggvocggggvggggvoggggvggggvoggggvggggvocjggggvggggvoggggvggggvoggg...

output:

1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #11:

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

input:

100 3
zshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshf...

output:

0000000000000000011111110000000000011111111111110000011111111111111111111111111111111111111111111111

result:

ok single line: '000000000000000001111111000000...1111111111111111111111111111111'

Test #12:

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

input:

100 12
fnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnj...

output:

0000000000000000000000000000000000011110000000000000000000000000000000011111110000000000000000000000

result:

ok single line: '000000000000000000000000000000...0011111110000000000000000000000'

Test #13:

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

input:

100 6
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...

output:

0000011000011100011110011111011111111111111111111111111111111111111111111111111111111111111111111111

result:

ok single line: '000001100001110001111001111101...1111111111111111111111111111111'

Subtask #2:

score: 0
Time Limit Exceeded

Test #14:

score: 20
Accepted
time: 1ms
memory: 1260kb

input:

100 2
xxyxxyyxxyxxyypxxyxxyyxxyxxyypxxyxxyyxxyxxyypwxxyxxyyxxyxxyypxxyxxyyxxyxxyypxxyxxyyxxyxxyypwex...

output:

0100010000000100000000000000011111111111111110000000000000000000000000000000000000000000000100000000

result:

ok single line: '010001000000010000000000000001...0000000000000000000000100000000'

Test #15:

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

input:

100 3
xxxyxxxyxxxyyxxxyxxxyxxxyyxxxyxxxyxxxyypxxxyxxxyxxxyyxxxyxxxyxxxyyxxxyxxxyxxxyypxxxyxxxyxxxyyx...

output:

0010000000010000000000000000000000000010000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '001000000001000000000000000000...0000000000000000000000000000000'

Test #16:

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

input:

100 2
baaaabbbaaabaabaaababbabaabbbabaaaabbababaaaabbaabbaaaababbaaabaaaaabbbbbaaaaabbbbbbaaabbaabaa...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #17:

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

input:

100 3
baaaabbbaaabaabaaababbabaabbbabaaaabbababaaaabbaabbaaaababbaaabaaaaabbbbbaaaaabbbbbbaaabbaabaa...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #18:

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

input:

100 15
xxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxx...

output:

0000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000001000000000000000...0000000000000000000000000000000'

Test #19:

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

input:

100 20
xxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxx...

output:

0000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000010000000000...0000000000000000000000000000000'

Test #20:

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

input:

100 7
xxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxx...

output:

0000001000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000

result:

ok single line: '000000100000000000000000000000...0000000000000000000000000000000'

Test #21:

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

input:

100 4
babbababaabababaabbaaabbbaaaaabaaababbbbaaaaabbbaabbbbaaabbbbabbaaaaaabababaabaababbbbabbbbbaa...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #22:

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

input:

100 5
kkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxskkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxskkkkkkxk...

output:

0000110000000000000000000000000000111111110000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000011000000000000000000000000...0000000000000000000000000000000'

Test #23:

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

input:

100 1
ggggvggggvoggggvggggvoggggvggggvocggggvggggvoggggvggggvoggggvggggvocjggggvggggvoggggvggggvoggg...

output:

1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #24:

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

input:

100 3
zshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshf...

output:

0000000000000000011111110000000000011111111111110000011111111111111111111111111111111111111111111111

result:

ok single line: '000000000000000001111111000000...1111111111111111111111111111111'

Test #25:

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

input:

100 12
fnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnj...

output:

0000000000000000000000000000000000011110000000000000000000000000000000011111110000000000000000000000

result:

ok single line: '000000000000000000000000000000...0011111110000000000000000000000'

Test #26:

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

input:

100 6
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...

output:

0000011000011100011110011111011111111111111111111111111111111111111111111111111111111111111111111111

result:

ok single line: '000001100001110001111001111101...1111111111111111111111111111111'

Test #27:

score: 0
Accepted
time: 982ms
memory: 1288kb

input:

2500 5
yyyyymyyyyymyyyyymyyyyymyyyyymwyyyyymyyyyymyyyyymyyyyymyyyyymwyyyyymyyyyymyyyyymyyyyymyyyyymw...

output:

0000100000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '000010000000000000000000000001...0000000000000000000000000000000'

Test #28:

score: -20
Time Limit Exceeded

input:

2500 2
bbbbbgbbbbbgfbbbbbgbbbbbgfbbbbbgbbbbbgfwbbbbbgbbbbbgfbbbbbgbbbbbgfbbbbbgbbbbbgfwzbbbbbgbbbbbg...

output:


result:


Subtask #3:

score: 0
Runtime Error

Test #51:

score: 0
Runtime Error

input:

1000000 23
cicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicicic...

output:


result:


Subtask #4:

score: 0
Time Limit Exceeded

Test #57:

score: 40
Accepted
time: 3ms
memory: 1260kb

input:

100 2
xxyxxyyxxyxxyypxxyxxyyxxyxxyypxxyxxyyxxyxxyypwxxyxxyyxxyxxyypxxyxxyyxxyxxyypxxyxxyyxxyxxyypwex...

output:

0100010000000100000000000000011111111111111110000000000000000000000000000000000000000000000100000000

result:

ok single line: '010001000000010000000000000001...0000000000000000000000100000000'

Test #58:

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

input:

100 3
xxxyxxxyxxxyyxxxyxxxyxxxyyxxxyxxxyxxxyypxxxyxxxyxxxyyxxxyxxxyxxxyyxxxyxxxyxxxyypxxxyxxxyxxxyyx...

output:

0010000000010000000000000000000000000010000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '001000000001000000000000000000...0000000000000000000000000000000'

Test #59:

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

input:

100 2
baaaabbbaaabaabaaababbabaabbbabaaaabbababaaaabbaabbaaaababbaaabaaaaabbbbbaaaaabbbbbbaaabbaabaa...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #60:

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

input:

100 3
baaaabbbaaabaabaaababbabaabbbabaaaabbababaaaabbaabbaaaababbaaabaaaaabbbbbaaaaabbbbbbaaabbaabaa...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #61:

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

input:

100 15
xxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxyxxxxxxxxxxxxx...

output:

0000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000001000000000000000...0000000000000000000000000000000'

Test #62:

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

input:

100 20
xxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxxxxxxxxxxxxxyxxxxxxxxx...

output:

0000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000010000000000...0000000000000000000000000000000'

Test #63:

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

input:

100 7
xxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyyxxxxxxxyxxxxxxxyxxxxxxxyxxxxxxxyxxxxx...

output:

0000001000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000

result:

ok single line: '000000100000000000000000000000...0000000000000000000000000000000'

Test #64:

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

input:

100 4
babbababaabababaabbaaabbbaaaaabaaababbbbaaaaabbbaabbbbaaabbbbabbaaaaaabababaabaababbbbabbbbbaa...

output:

0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000000000000000000000000000000...0000000000000000000000000000000'

Test #65:

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

input:

100 5
kkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxskkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxkkkkkkxskkkkkkxk...

output:

0000110000000000000000000000000000111111110000000000000000000000000000000000000000000000000000000000

result:

ok single line: '000011000000000000000000000000...0000000000000000000000000000000'

Test #66:

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

input:

100 1
ggggvggggvoggggvggggvoggggvggggvocggggvggggvoggggvggggvoggggvggggvocjggggvggggvoggggvggggvoggg...

output:

1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #67:

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

input:

100 3
zshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshffbzshf...

output:

0000000000000000011111110000000000011111111111110000011111111111111111111111111111111111111111111111

result:

ok single line: '000000000000000001111111000000...1111111111111111111111111111111'

Test #68:

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

input:

100 12
fnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnjfnj...

output:

0000000000000000000000000000000000011110000000000000000000000000000000011111110000000000000000000000

result:

ok single line: '000000000000000000000000000000...0011111110000000000000000000000'

Test #69:

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

input:

100 6
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd...

output:

0000011000011100011110011111011111111111111111111111111111111111111111111111111111111111111111111111

result:

ok single line: '000001100001110001111001111101...1111111111111111111111111111111'

Test #70:

score: -40
Time Limit Exceeded

input:

2500 5
yyyyymyyyyymyyyyymyyyyymyyyyymwyyyyymyyyyymyyyyymyyyyymyyyyymwyyyyymyyyyymyyyyymyyyyymyyyyymw...

output:


result: