답안 #959338

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
959338 2024-04-08T03:57:18 Z Darren0724 "The Lyuboyn" code (IZhO19_lyuboyn) C++17
100 / 100
162 ms 5460 KB
#include <bits/stdc++.h>
using namespace std;
#define LCBorz ios_base::sync_with_stdio(false); cin.tie(0);
#define int long long
#define all(x) x.begin(), x.end()
#define endl '\n'
const int N=200005;
const int INF=1e18;

int32_t main() {
    LCBorz;
    int n,k,t;cin>>n>>k>>t;
    if(k%2==0){
        cout<<-1<<endl;
        return 0;
    }
    string str;cin>>str;
    int s=0;
    for(char c:str){
        s=s<<1|(c&1);
    }
    vector<int> v(n+2);
    for(int i=0;i<=k;i++){
        v[i]=(1<<k+1)-(1<<i)-1;
        //01110
        //01101
        //01011
        //00111
        //10011
    }
    for(int i=k+1;i<n;i++){
        v[i]=(1<<i)+(1<<k-1)-1;
    }
    cout<<(1<<n)<<endl;
    for(int i=1;i<=(1<<n);i++){
        for(int j=n-1;j>=0;j--){
            cout<<((s>>j)&1);
        }
        cout<<endl;
        int p=__lg(i&(-i));
        s^=v[p];
    }
    return 0;
}

Compilation message

lyuboyn.cpp: In function 'int32_t main()':
lyuboyn.cpp:24:19: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   24 |         v[i]=(1<<k+1)-(1<<i)-1;
      |                  ~^~
lyuboyn.cpp:32:26: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
   32 |         v[i]=(1<<i)+(1<<k-1)-1;
      |                         ~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Ok
2 Correct 0 ms 348 KB Ok
3 Correct 1 ms 456 KB Ok
4 Correct 1 ms 348 KB Ok
5 Correct 0 ms 344 KB Ok
6 Correct 0 ms 348 KB Ok
7 Correct 1 ms 348 KB Ok
8 Correct 0 ms 348 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 155 ms 5276 KB Ok
2 Correct 73 ms 2716 KB Ok
3 Correct 1 ms 344 KB Ok
4 Correct 1 ms 348 KB Ok
5 Correct 0 ms 348 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Ok
2 Correct 4 ms 348 KB Ok
3 Correct 87 ms 2676 KB Ok
4 Correct 34 ms 1364 KB Ok
5 Correct 0 ms 348 KB Ok
6 Correct 2 ms 348 KB Ok
7 Correct 21 ms 940 KB Ok
8 Correct 1 ms 600 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 155 ms 5416 KB Ok
2 Correct 152 ms 5200 KB Ok
3 Correct 152 ms 5416 KB Ok
4 Correct 73 ms 2736 KB Ok
5 Correct 73 ms 2680 KB Ok
6 Correct 35 ms 1368 KB Ok
7 Correct 34 ms 1372 KB Ok
8 Correct 17 ms 856 KB Ok
9 Correct 16 ms 860 KB Ok
10 Correct 8 ms 604 KB Ok
11 Correct 1 ms 348 KB Ok
12 Correct 1 ms 348 KB Ok
13 Correct 0 ms 348 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 155 ms 5276 KB Ok
2 Correct 73 ms 2716 KB Ok
3 Correct 1 ms 344 KB Ok
4 Correct 1 ms 348 KB Ok
5 Correct 0 ms 348 KB Ok
6 Correct 0 ms 348 KB Ok
7 Correct 4 ms 348 KB Ok
8 Correct 87 ms 2676 KB Ok
9 Correct 34 ms 1364 KB Ok
10 Correct 0 ms 348 KB Ok
11 Correct 2 ms 348 KB Ok
12 Correct 21 ms 940 KB Ok
13 Correct 1 ms 600 KB Ok
14 Correct 155 ms 5416 KB Ok
15 Correct 152 ms 5200 KB Ok
16 Correct 152 ms 5416 KB Ok
17 Correct 73 ms 2736 KB Ok
18 Correct 73 ms 2680 KB Ok
19 Correct 35 ms 1368 KB Ok
20 Correct 34 ms 1372 KB Ok
21 Correct 17 ms 856 KB Ok
22 Correct 16 ms 860 KB Ok
23 Correct 8 ms 604 KB Ok
24 Correct 1 ms 348 KB Ok
25 Correct 1 ms 348 KB Ok
26 Correct 0 ms 348 KB Ok
27 Correct 156 ms 5452 KB Ok
28 Correct 73 ms 2788 KB Ok
29 Correct 158 ms 5244 KB Ok
30 Correct 8 ms 604 KB Ok
31 Correct 1 ms 348 KB Ok
32 Correct 4 ms 348 KB Ok
33 Correct 17 ms 860 KB Ok
34 Correct 1 ms 348 KB Ok
35 Correct 0 ms 348 KB Ok
36 Correct 0 ms 348 KB Ok
37 Correct 0 ms 348 KB Ok
38 Correct 79 ms 2704 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 75 ms 2640 KB Ok
2 Correct 155 ms 5388 KB Ok
3 Correct 157 ms 5196 KB Ok
4 Correct 8 ms 604 KB Ok
5 Correct 1 ms 344 KB Ok
6 Correct 17 ms 856 KB Ok
7 Correct 162 ms 5460 KB Ok
8 Correct 1 ms 348 KB Ok
9 Correct 0 ms 348 KB Ok
10 Correct 1 ms 348 KB Ok
11 Correct 35 ms 1552 KB Ok
12 Correct 74 ms 2644 KB Ok