# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
471394 | 2021-09-08T22:00:57 Z | aZvezda | "The Lyuboyn" code (IZhO19_lyuboyn) | C++14 | 308 ms | 6568 KB |
#include <bits/stdc++.h> using namespace std; #define endl "\n" typedef long long ll; vector<int> build(int n, int k) { if(k == 1) { if(n == 1) { return {0, 1}; } auto ans = build(n - 1, k); auto cpy = ans; reverse(cpy.begin(), cpy.end()); vector<int> ret; for(auto it : ans) { ret.push_back(it * 2); } for(auto it : cpy) { ret.push_back(it * 2 + 1); } return ret; } auto ans = build(n - 2, k - 2); vector<int> ret; for(int i = 0; i < ans.size(); i ++) { auto it = ans[i]; if(i & 1) { ret.push_back(it * 4 + 0); } else { ret.push_back(it * 4 + 3); } } for(int i = 0; i < ans.size(); i ++) { auto it = ans[i]; if(i & 1) { ret.push_back((it ^ (1 << (k - 1))) * 4 + 1); } else { ret.push_back((it ^ (1 << (k - 1))) * 4 + 2); } } for(int i = 0; i < ans.size(); i ++) { auto it = ans[i]; if(i & 1) { ret.push_back(it * 4 + 3); } else { ret.push_back(it * 4 + 0); } } for(int i = 0; i < ans.size(); i ++) { auto it = ans[i]; if(i & 1) { ret.push_back((it ^ (1 << (k - 1))) * 4 + 2); } else { ret.push_back((it ^ (1 << (k - 1))) * 4 + 1); } } return ret; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, k, t, s = 0; cin >> n >> k >> t; if(k % 2 == 0) { cout << -1 << endl; return 0; } string str; cin >> str; int w = 1; for(auto it : str) { s = s + (it - '0') * w; w *= 2; } auto ans = build(n, k); s = ans[0] ^ s; cout << ans.size() << endl; for(auto it : ans) { int real = it ^ s; for(int i = 0; i < n; i ++) { cout << (bool)(real & (1 << i)); } cout << endl; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 236 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Fail, not exactly k bits are different: line = 3 |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Ok |
2 | Correct | 0 ms | 204 KB | Ok |
3 | Correct | 0 ms | 204 KB | Ok |
4 | Correct | 1 ms | 204 KB | Ok |
5 | Correct | 0 ms | 204 KB | Ok |
6 | Correct | 0 ms | 204 KB | Ok |
7 | Correct | 0 ms | 204 KB | Ok |
8 | Correct | 0 ms | 204 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 308 ms | 6568 KB | Ok |
2 | Correct | 141 ms | 3260 KB | Ok |
3 | Correct | 1 ms | 332 KB | Ok |
4 | Correct | 1 ms | 204 KB | Ok |
5 | Correct | 1 ms | 204 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Ok |
2 | Correct | 7 ms | 484 KB | Ok |
3 | Correct | 140 ms | 3476 KB | Ok |
4 | Correct | 73 ms | 1772 KB | Ok |
5 | Correct | 1 ms | 204 KB | Ok |
6 | Correct | 2 ms | 332 KB | Ok |
7 | Correct | 32 ms | 1012 KB | Ok |
8 | Correct | 1 ms | 204 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 299 ms | 6424 KB | Fail, not exactly k bits are different: line = 16383 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 308 ms | 6568 KB | Ok |
2 | Correct | 141 ms | 3260 KB | Ok |
3 | Correct | 1 ms | 332 KB | Ok |
4 | Correct | 1 ms | 204 KB | Ok |
5 | Correct | 1 ms | 204 KB | Ok |
6 | Correct | 1 ms | 204 KB | Ok |
7 | Correct | 7 ms | 484 KB | Ok |
8 | Correct | 140 ms | 3476 KB | Ok |
9 | Correct | 73 ms | 1772 KB | Ok |
10 | Correct | 1 ms | 204 KB | Ok |
11 | Correct | 2 ms | 332 KB | Ok |
12 | Correct | 32 ms | 1012 KB | Ok |
13 | Correct | 1 ms | 204 KB | Ok |
14 | Incorrect | 299 ms | 6424 KB | Fail, not exactly k bits are different: line = 16383 |
15 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 140 ms | 3196 KB | Fail, not exactly k bits are different: line = 31 |
2 | Halted | 0 ms | 0 KB | - |