# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
151315 | 2019-09-02T12:40:38 Z | theboatman | "The Lyuboyn" code (IZhO19_lyuboyn) | C++17 | 67 ms | 7528 KB |
#include <bits/stdc++.h> #define y1 theboatman #define make_struct(args...) {args} using namespace std; typedef long long ll; const long long INF = 1e18 + 10; const int inf = 1e9 + 10; const int N = 1e6 + 10; string mask(int x, int n) { string mask; while(x) { mask.push_back(char((x % 2) + '0')); x /= 2; } reverse(mask.begin(), mask.end()); while(mask.size() < n) { mask.push_back('0'); } return mask; } int dist(int x, int y) { return __builtin_popcount(x ^ y); } void check(vector <int> ans, int k, int t) { for(int i = 1; i < ans.size(); i++) { if (dist(ans[i], ans[i - 1]) != k) { cout << "-1\n"; exit(0); } } if (t && dist(ans.back(), ans[0]) != k) { cout << "-1\n"; exit(0); } } int main() { cin.tie(0); ios::sync_with_stdio(0); int n, k, t; cin >> n >> k >> t; string s; cin >> s; vector <int> st; for(int i = 0; i < (1 << n); i++) { st.push_back(i ^ (i >> k)); } int pos = 0; for(auto i : st) { if (mask(i, n) == s) { break; } pos++; } vector <int> ans; for(int i = pos; i < (1 << n); i++) { ans.push_back(st[i]); } for(int i = 0; i < pos; i++) { ans.push_back(st[i]); } check(ans, k, t); if (mask(ans[0], n) != s) { cout << 1 / 0 << "\n"; } cout << ans.size() << "\n"; for(auto i : ans) { cout << mask(i, n) << "\n"; } return 0; } /* */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | The values in the output sequence are not pairwise distinct! |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output -1 while solution exists |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Ok |
2 | Correct | 7 ms | 3564 KB | Ok |
3 | Correct | 4 ms | 1976 KB | Ok |
4 | Correct | 2 ms | 296 KB | Ok |
5 | Correct | 2 ms | 348 KB | Ok |
6 | Correct | 2 ms | 376 KB | Ok |
7 | Correct | 2 ms | 504 KB | Ok |
8 | Correct | 4 ms | 2028 KB | Ok |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 67 ms | 7528 KB | The values in the output sequence are not pairwise distinct! |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output -1 while solution exists |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 45 ms | 3544 KB | Output -1 while solution exists |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 67 ms | 7528 KB | The values in the output sequence are not pairwise distinct! |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 23 ms | 2048 KB | Output -1 while solution exists |
2 | Halted | 0 ms | 0 KB | - |