Submission #243576

#TimeUsernameProblemLanguageResultExecution timeMemory
243576toonewbie"The Lyuboyn" code (IZhO19_lyuboyn)C++17
14 / 100
79 ms9688 KiB
#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 (stderr)

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;
               ~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...