답안 #345637

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
345637 2021-01-07T17:33:31 Z georgerapeanu "The Lyuboyn" code (IZhO19_lyuboyn) C++11
34 / 100
509 ms 6644 KB
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int n,k,t,fst;
vector<int> v;
string s;

int main(){
    

    cin >> n >> k >> t;
    cin >> s;

    for(auto it:s){
        fst = fst * 2 + it - '0';
    }

    if(k % 2 == 0){
        printf("-1");
        return 0;
    }

    printf("%d\n",(1 << n));

    int _n = 2;
    int _k = 1;
    v = {0,1,3,2};

    while(_k < k){
        vector<int> nv;
        for(int i = 0;i < (1 << _n);i++){
            nv.push_back(v[i] ^ ((i % 2 == 0 ? 0:3) << _n));
        }
        for(int i = 0;i < (1 << _n);i++){
            nv.push_back(((1 << _n) - 1) ^ v[(1 << _n) - 1 - i] ^ ((i % 2 == 0 ? 2:1) << _n));
        }
        for(int i = 0;i < (1 << _n);i++){
            nv.push_back(v[i] ^ ((i % 2 == 0 ? 3:0) << _n));
        }
        for(int i = 0;i < (1 << _n);i++){
            nv.push_back(((1 << _n) - 1) ^ v[(1 << _n) - 1 - i] ^ ((i % 2 == 0 ? 1:2) << _n));
        }

        _k += 2;
        _n += 2;
        v = nv;
    }
    
    while(_n < n){
        vector<int> nv;
        for(int i = 0;i < (1 << _n);i++){
            nv.push_back(v[i]);
        }
        for(int i = 0;i < (1 << _n);i++){
            nv.push_back(v[i] ^ (1 << _n));
        }
        for(int h = 0;h < _n;h++){
            if(((v[0] >> h) & 1) != ((v[(1 << _n) - 1] >> h) & 1)){
                for(int i = (1 << _n);i < (2 << _n);i++){
                    nv[i] ^= (1 << h);
                }
                break;
            }
        }
        _n++;
        v = nv;
    }

/*
    for(int i = 0;i < (1 << n);i++){
        printf("%d ",__builtin_popcount(v[i] ^ v[(i + 1) & ((1 << n) - 1)]));
    }
    printf("\n");
*/
    for(int i = 0;i < (1 << n);i++){
        v[i] ^= fst;
        for(int h = 0;h < n;h++){
            printf("%d",((v[i] >> h)) & 1);
        }
        printf("\n");
    }
    printf("\n");

    return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 364 KB First number in answer is not x 1 2
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 0 ms 364 KB Ok
6 Correct 0 ms 364 KB Ok
7 Correct 1 ms 364 KB Ok
8 Correct 0 ms 364 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 492 ms 6644 KB Ok
2 Correct 229 ms 3324 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 12 ms 492 KB Ok
3 Correct 234 ms 3580 KB Ok
4 Correct 112 ms 1924 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 3 ms 364 KB Ok
7 Correct 52 ms 1164 KB Ok
8 Correct 1 ms 364 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Incorrect 509 ms 6528 KB First number in answer is not x 44202 87252
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 492 ms 6644 KB Ok
2 Correct 229 ms 3324 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 12 ms 492 KB Ok
8 Correct 234 ms 3580 KB Ok
9 Correct 112 ms 1924 KB Ok
10 Correct 1 ms 364 KB Ok
11 Correct 3 ms 364 KB Ok
12 Correct 52 ms 1164 KB Ok
13 Correct 1 ms 364 KB Ok
14 Incorrect 509 ms 6528 KB First number in answer is not x 44202 87252
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 243 ms 3296 KB First number in answer is not x 92826 45741
2 Halted 0 ms 0 KB -