#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define pb emplace_back
#define AI(i) begin(i), end(i)
template<class T> bool chmin(T &a, T b) { return b < a && (a = b, true); }
template<class T> bool chmax(T &a, T b) { return a < b && (a = b, true); }
#ifdef KEV
#define DE(args...) kout("[ " + string(#args) + " ] = ", args)
void kout() { cerr << endl; }
template<class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ', kout(b...); }
template<class T> void debug(T L, T R) { while (L != R) cerr << *L << " \n"[next(L) == R], ++L; }
#else
#define DE(...) 0
#define debug(...) 0
#endif
const int MAX_N = 18, MAX_M = 1<<MAX_N;
int N, K, T, S;
int nxt[MAX_M];
void ob(int x) {
for (int i = N-1;i >= 0;--i)
cout << (x>>i&1);
cout << '\n';
}
vector<int> xo;
int32_t main() {
ios_base::sync_with_stdio(0), cin.tie(0);
cin >> N >> K >> T;
{
string v;
cin >> v;
DE(v);
for (char i : v)
S = (S<<1) | (i-'0');
DE(S);
}
for (int i = 0;i < 1<<N;++i)
if (__builtin_popcount(i) == K)
xo.pb(i);
vector<int> per;
int ind = 0;
vector<int> vis(1<<N);
for (int i = 0, x = 0;i < 1<<N;++i) {
per.pb(x);
vis[x] = true;
for (int u : xo)
if (!vis[x ^ u]) {
x ^= u;
break;
}
if (x == per.back()) break;
}
if (per.size() != (1<<N)) return puts("-1"), 0;
cout << per.size() << '\n';
for (int u : per)
ob(u ^ S);
}
Compilation message
lyuboyn.cpp: In function 'int32_t main()':
lyuboyn.cpp:14:17: warning: statement has no effect [-Wunused-value]
14 | #define DE(...) 0
| ^
lyuboyn.cpp:36:3: note: in expansion of macro 'DE'
36 | DE(v);
| ^~
lyuboyn.cpp:14:17: warning: statement has no effect [-Wunused-value]
14 | #define DE(...) 0
| ^
lyuboyn.cpp:39:3: note: in expansion of macro 'DE'
39 | DE(S);
| ^~
lyuboyn.cpp:62:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
62 | if (per.size() != (1<<N)) return puts("-1"), 0;
| ~~~~~~~~~~~^~~~~~~~~
lyuboyn.cpp:48:6: warning: unused variable 'ind' [-Wunused-variable]
48 | int ind = 0;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Ok |
2 |
Correct |
5 ms |
2032 KB |
Ok |
3 |
Correct |
3 ms |
1388 KB |
Ok |
4 |
Correct |
1 ms |
364 KB |
Ok |
5 |
Correct |
1 ms |
364 KB |
Ok |
6 |
Correct |
1 ms |
364 KB |
Ok |
7 |
Correct |
1 ms |
364 KB |
Ok |
8 |
Correct |
2 ms |
1292 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
271 ms |
7656 KB |
Ok |
2 |
Correct |
125 ms |
3820 KB |
Ok |
3 |
Correct |
1 ms |
364 KB |
Ok |
4 |
Correct |
1 ms |
364 KB |
Ok |
5 |
Correct |
1 ms |
364 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Ok |
2 |
Correct |
6 ms |
492 KB |
Ok |
3 |
Correct |
123 ms |
3948 KB |
Ok |
4 |
Correct |
58 ms |
2160 KB |
Ok |
5 |
Correct |
1 ms |
364 KB |
Ok |
6 |
Correct |
2 ms |
364 KB |
Ok |
7 |
Correct |
28 ms |
1260 KB |
Ok |
8 |
Correct |
1 ms |
364 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
260 ms |
7776 KB |
Ok |
2 |
Correct |
260 ms |
7520 KB |
Ok |
3 |
Correct |
259 ms |
7528 KB |
Ok |
4 |
Correct |
123 ms |
3940 KB |
Ok |
5 |
Correct |
142 ms |
3820 KB |
Ok |
6 |
Correct |
58 ms |
2188 KB |
Ok |
7 |
Correct |
59 ms |
2160 KB |
Ok |
8 |
Correct |
33 ms |
1260 KB |
Ok |
9 |
Correct |
28 ms |
1260 KB |
Ok |
10 |
Correct |
13 ms |
748 KB |
Ok |
11 |
Correct |
1 ms |
364 KB |
Ok |
12 |
Correct |
1 ms |
364 KB |
Ok |
13 |
Correct |
1 ms |
364 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
271 ms |
7656 KB |
Ok |
2 |
Correct |
125 ms |
3820 KB |
Ok |
3 |
Correct |
1 ms |
364 KB |
Ok |
4 |
Correct |
1 ms |
364 KB |
Ok |
5 |
Correct |
1 ms |
364 KB |
Ok |
6 |
Correct |
1 ms |
364 KB |
Ok |
7 |
Correct |
6 ms |
492 KB |
Ok |
8 |
Correct |
123 ms |
3948 KB |
Ok |
9 |
Correct |
58 ms |
2160 KB |
Ok |
10 |
Correct |
1 ms |
364 KB |
Ok |
11 |
Correct |
2 ms |
364 KB |
Ok |
12 |
Correct |
28 ms |
1260 KB |
Ok |
13 |
Correct |
1 ms |
364 KB |
Ok |
14 |
Correct |
260 ms |
7776 KB |
Ok |
15 |
Correct |
260 ms |
7520 KB |
Ok |
16 |
Correct |
259 ms |
7528 KB |
Ok |
17 |
Correct |
123 ms |
3940 KB |
Ok |
18 |
Correct |
142 ms |
3820 KB |
Ok |
19 |
Correct |
58 ms |
2188 KB |
Ok |
20 |
Correct |
59 ms |
2160 KB |
Ok |
21 |
Correct |
33 ms |
1260 KB |
Ok |
22 |
Correct |
28 ms |
1260 KB |
Ok |
23 |
Correct |
13 ms |
748 KB |
Ok |
24 |
Correct |
1 ms |
364 KB |
Ok |
25 |
Correct |
1 ms |
364 KB |
Ok |
26 |
Correct |
1 ms |
364 KB |
Ok |
27 |
Correct |
274 ms |
7656 KB |
Ok |
28 |
Correct |
129 ms |
3960 KB |
Ok |
29 |
Correct |
272 ms |
7836 KB |
Ok |
30 |
Correct |
14 ms |
748 KB |
Ok |
31 |
Correct |
1 ms |
364 KB |
Ok |
32 |
Correct |
6 ms |
492 KB |
Ok |
33 |
Correct |
28 ms |
1260 KB |
Ok |
34 |
Correct |
1 ms |
364 KB |
Ok |
35 |
Correct |
1 ms |
492 KB |
Ok |
36 |
Correct |
1 ms |
364 KB |
Ok |
37 |
Correct |
0 ms |
364 KB |
Ok |
38 |
Correct |
125 ms |
3820 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
127 ms |
3820 KB |
Ok |
2 |
Correct |
263 ms |
7656 KB |
Ok |
3 |
Correct |
263 ms |
7648 KB |
Ok |
4 |
Correct |
14 ms |
748 KB |
Ok |
5 |
Correct |
1 ms |
364 KB |
Ok |
6 |
Correct |
28 ms |
1260 KB |
Ok |
7 |
Correct |
263 ms |
7676 KB |
Ok |
8 |
Correct |
1 ms |
364 KB |
Ok |
9 |
Correct |
1 ms |
364 KB |
Ok |
10 |
Correct |
1 ms |
364 KB |
Ok |
11 |
Correct |
59 ms |
2160 KB |
Ok |
12 |
Correct |
125 ms |
3960 KB |
Ok |