답안 #341129

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
341129 2020-12-29T03:27:05 Z juggernaut "The Lyuboyn" code (IZhO19_lyuboyn) C++14
100 / 100
502 ms 5652 KB
#include<bits/stdc++.h>
using namespace std;
char _S[20];
int B[262144],n,k,t;
int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    cin>>n>>k>>t>>_S;
    if(k+1&1){
        puts("-1");
        return 0;
    }
    int S=0;
    for(int i=0;i<n;i++)S=S<<1|_S[i]-'0';
    for(int i=0;i<=k;i++)
        B[1<<i]=(1<<k+1)-(1<<i)-1;
    for(int i=k+1;i<n;i++)
        B[1<<i]=(1<<k-1)+(1<<i)-1;
    printf("%d\n",1<<n);
    for(int i=0;i<(1<<n);i++){
        S^=B[i&-i];
        for(int j=n;j--;)printf("%d",(S>>j)&1);
        puts("");
    }
}

Compilation message

lyuboyn.cpp: In function 'int main()':
lyuboyn.cpp:8:9: warning: suggest parentheses around '+' in operand of '&' [-Wparentheses]
    8 |     if(k+1&1){
      |        ~^~
lyuboyn.cpp:13:37: warning: suggest parentheses around arithmetic in operand of '|' [-Wparentheses]
   13 |     for(int i=0;i<n;i++)S=S<<1|_S[i]-'0';
      |                                ~~~~~^~~~
lyuboyn.cpp:15:22: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   15 |         B[1<<i]=(1<<k+1)-(1<<i)-1;
      |                     ~^~
lyuboyn.cpp:17:22: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   17 |         B[1<<i]=(1<<k-1)+(1<<i)-1;
      |                     ~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Ok
2 Correct 1 ms 364 KB Ok
3 Correct 1 ms 364 KB Ok
4 Correct 1 ms 364 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 1 ms 364 KB Ok
7 Correct 1 ms 364 KB Ok
8 Correct 1 ms 364 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 502 ms 5560 KB Ok
2 Correct 235 ms 2796 KB Ok
3 Correct 2 ms 364 KB Ok
4 Correct 1 ms 364 KB Ok
5 Correct 1 ms 364 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Ok
2 Correct 15 ms 492 KB Ok
3 Correct 263 ms 3028 KB Ok
4 Correct 107 ms 1644 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 3 ms 364 KB Ok
7 Correct 54 ms 876 KB Ok
8 Correct 1 ms 364 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 488 ms 5484 KB Ok
2 Correct 478 ms 5356 KB Ok
3 Correct 494 ms 5356 KB Ok
4 Correct 236 ms 2796 KB Ok
5 Correct 251 ms 2796 KB Ok
6 Correct 106 ms 1516 KB Ok
7 Correct 108 ms 1516 KB Ok
8 Correct 50 ms 876 KB Ok
9 Correct 53 ms 876 KB Ok
10 Correct 23 ms 620 KB Ok
11 Correct 2 ms 364 KB Ok
12 Correct 2 ms 364 KB Ok
13 Correct 1 ms 364 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 502 ms 5560 KB Ok
2 Correct 235 ms 2796 KB Ok
3 Correct 2 ms 364 KB Ok
4 Correct 1 ms 364 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 1 ms 364 KB Ok
7 Correct 15 ms 492 KB Ok
8 Correct 263 ms 3028 KB Ok
9 Correct 107 ms 1644 KB Ok
10 Correct 1 ms 364 KB Ok
11 Correct 3 ms 364 KB Ok
12 Correct 54 ms 876 KB Ok
13 Correct 1 ms 364 KB Ok
14 Correct 488 ms 5484 KB Ok
15 Correct 478 ms 5356 KB Ok
16 Correct 494 ms 5356 KB Ok
17 Correct 236 ms 2796 KB Ok
18 Correct 251 ms 2796 KB Ok
19 Correct 106 ms 1516 KB Ok
20 Correct 108 ms 1516 KB Ok
21 Correct 50 ms 876 KB Ok
22 Correct 53 ms 876 KB Ok
23 Correct 23 ms 620 KB Ok
24 Correct 2 ms 364 KB Ok
25 Correct 2 ms 364 KB Ok
26 Correct 1 ms 364 KB Ok
27 Correct 488 ms 5356 KB Ok
28 Correct 230 ms 2796 KB Ok
29 Correct 496 ms 5484 KB Ok
30 Correct 25 ms 620 KB Ok
31 Correct 2 ms 364 KB Ok
32 Correct 11 ms 492 KB Ok
33 Correct 52 ms 876 KB Ok
34 Correct 1 ms 364 KB Ok
35 Correct 1 ms 364 KB Ok
36 Correct 1 ms 364 KB Ok
37 Correct 1 ms 364 KB Ok
38 Correct 226 ms 2796 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 227 ms 2720 KB Ok
2 Correct 490 ms 5652 KB Ok
3 Correct 480 ms 5392 KB Ok
4 Correct 27 ms 620 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 57 ms 892 KB Ok
7 Correct 486 ms 5484 KB Ok
8 Correct 2 ms 364 KB Ok
9 Correct 1 ms 364 KB Ok
10 Correct 2 ms 364 KB Ok
11 Correct 116 ms 1516 KB Ok
12 Correct 224 ms 2796 KB Ok