# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
243576 | toonewbie | "The Lyuboyn" code (IZhO19_lyuboyn) | C++17 | 79 ms | 9688 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |