답안 #243576

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
243576 2020-07-01T10:45:47 Z toonewbie "The Lyuboyn" code (IZhO19_lyuboyn) C++17
14 / 100
79 ms 9688 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define endl '\n'

const int MOD = 1e9 + 7;
const int N = 10005;

void add(vector<ll> &bs, ll A) {
    for (ll x : bs) A = min(A, A ^ x);
    if (A) {
        bs.push_back(A);
    }
}

string binary(ll x) {
    string res = "";
    while(x > 0) {
        res += x % 2 + 48;
        x /= 2;
    }
    reverse(res.begin(), res.end());
    return res;
}

int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    int n, k, t;
    cin >> n >> k >> t;
    if (!(k & 1)) return cout << -1 << endl, 0;
    vector <ll> A;
    for (int i = 0; i < (1 << n); i++) {
        if (__builtin_popcount(i) == k) {
            add(A, i);
        }
    }
    cout << (1 << n) << endl;
    vector <ll> v, tmp; v.push_back(0); tmp = v;
    for (ll cur : A) {
        for (ll x : tmp) {
            v.push_back(cur ^ x);
        }
        tmp = v;
        reverse(tmp.begin(), tmp.end());
    }
    for (ll x : v) {
        string ans = binary(x);
        while(ans.size() < n) ans = '0' + ans;
        cout << ans << endl;
    }
    return 0;
}

Compilation message

lyuboyn.cpp: In function 'int main()':
lyuboyn.cpp:51:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         while(ans.size() < n) ans = '0' + ans;
               ~~~~~~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB First number in answer is not x 1 0
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Fail, not exactly k bits are different: line = 3
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Ok
2 Correct 5 ms 384 KB Ok
3 Correct 5 ms 384 KB Ok
4 Correct 4 ms 384 KB Ok
5 Correct 5 ms 384 KB Ok
6 Correct 5 ms 384 KB Ok
7 Correct 4 ms 384 KB Ok
8 Correct 5 ms 384 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 77 ms 9676 KB Ok
2 Correct 41 ms 4960 KB Ok
3 Correct 5 ms 384 KB Ok
4 Correct 5 ms 384 KB Ok
5 Correct 5 ms 384 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 384 KB Fail, not exactly k bits are different: line = 3
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 79 ms 9688 KB First number in answer is not x 44202 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 77 ms 9676 KB Ok
2 Correct 41 ms 4960 KB Ok
3 Correct 5 ms 384 KB Ok
4 Correct 5 ms 384 KB Ok
5 Correct 5 ms 384 KB Ok
6 Incorrect 5 ms 384 KB Fail, not exactly k bits are different: line = 3
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 40 ms 5012 KB First number in answer is not x 92826 0
2 Halted 0 ms 0 KB -