#include <bits/stdc++.h>
using namespace std;
int N, K, T, S;
string st;
int usable[1000005];
vector<int> kdiff, ans;
void dfs(int x){
usable[x] = 0;
ans.push_back(x);
for (auto it : kdiff){
if (usable[x ^ it]){
dfs(x ^ it);
return;
}
}
}
string intToString(int x){
string r;
for (int i = 0; i < N; ++i){
r = ((x & (1 << i)) ? '1' : '0') + r;
}
return r;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> N >> K >> T;
cin >> st;
for (int i = 0; i < (int) st.size(); ++i){
S *= 2;
S += (int) (st[i]-'0');
}
for (int i = 0; i < (1 << N); ++i){
if (__builtin_popcount(i) == K){
kdiff.push_back(i);
}
usable[i] = 1;
}
dfs(S);
if ((int) ans.size() != (1 << N)){
cout << -1 << '\n';
}
else{
cout << (1 << N) << '\n';
for (auto it : ans){
cout << intToString(it) << '\n';
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
512 KB |
Ok |
2 |
Correct |
8 ms |
6144 KB |
Ok |
3 |
Correct |
5 ms |
3452 KB |
Ok |
4 |
Correct |
0 ms |
384 KB |
Ok |
5 |
Correct |
0 ms |
384 KB |
Ok |
6 |
Correct |
0 ms |
384 KB |
Ok |
7 |
Correct |
1 ms |
512 KB |
Ok |
8 |
Correct |
5 ms |
3360 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
199 ms |
15728 KB |
Ok |
2 |
Correct |
90 ms |
7924 KB |
Ok |
3 |
Correct |
1 ms |
384 KB |
Ok |
4 |
Correct |
0 ms |
384 KB |
Ok |
5 |
Correct |
0 ms |
384 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Ok |
2 |
Correct |
5 ms |
768 KB |
Ok |
3 |
Correct |
89 ms |
7928 KB |
Ok |
4 |
Correct |
43 ms |
4220 KB |
Ok |
5 |
Correct |
1 ms |
384 KB |
Ok |
6 |
Correct |
1 ms |
384 KB |
Ok |
7 |
Correct |
20 ms |
2304 KB |
Ok |
8 |
Correct |
0 ms |
384 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
199 ms |
15852 KB |
Ok |
2 |
Correct |
199 ms |
15828 KB |
Ok |
3 |
Correct |
198 ms |
15796 KB |
Ok |
4 |
Correct |
94 ms |
8044 KB |
Ok |
5 |
Correct |
92 ms |
8056 KB |
Ok |
6 |
Correct |
43 ms |
4248 KB |
Ok |
7 |
Correct |
43 ms |
4216 KB |
Ok |
8 |
Correct |
19 ms |
2304 KB |
Ok |
9 |
Correct |
19 ms |
2304 KB |
Ok |
10 |
Correct |
10 ms |
1280 KB |
Ok |
11 |
Correct |
1 ms |
384 KB |
Ok |
12 |
Correct |
1 ms |
384 KB |
Ok |
13 |
Correct |
0 ms |
384 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
199 ms |
15728 KB |
Ok |
2 |
Correct |
90 ms |
7924 KB |
Ok |
3 |
Correct |
1 ms |
384 KB |
Ok |
4 |
Correct |
0 ms |
384 KB |
Ok |
5 |
Correct |
0 ms |
384 KB |
Ok |
6 |
Correct |
0 ms |
384 KB |
Ok |
7 |
Correct |
5 ms |
768 KB |
Ok |
8 |
Correct |
89 ms |
7928 KB |
Ok |
9 |
Correct |
43 ms |
4220 KB |
Ok |
10 |
Correct |
1 ms |
384 KB |
Ok |
11 |
Correct |
1 ms |
384 KB |
Ok |
12 |
Correct |
20 ms |
2304 KB |
Ok |
13 |
Correct |
0 ms |
384 KB |
Ok |
14 |
Correct |
199 ms |
15852 KB |
Ok |
15 |
Correct |
199 ms |
15828 KB |
Ok |
16 |
Correct |
198 ms |
15796 KB |
Ok |
17 |
Correct |
94 ms |
8044 KB |
Ok |
18 |
Correct |
92 ms |
8056 KB |
Ok |
19 |
Correct |
43 ms |
4248 KB |
Ok |
20 |
Correct |
43 ms |
4216 KB |
Ok |
21 |
Correct |
19 ms |
2304 KB |
Ok |
22 |
Correct |
19 ms |
2304 KB |
Ok |
23 |
Correct |
10 ms |
1280 KB |
Ok |
24 |
Correct |
1 ms |
384 KB |
Ok |
25 |
Correct |
1 ms |
384 KB |
Ok |
26 |
Correct |
0 ms |
384 KB |
Ok |
27 |
Correct |
209 ms |
15796 KB |
Ok |
28 |
Correct |
91 ms |
7940 KB |
Ok |
29 |
Correct |
200 ms |
15852 KB |
Ok |
30 |
Correct |
9 ms |
1280 KB |
Ok |
31 |
Correct |
1 ms |
384 KB |
Ok |
32 |
Correct |
4 ms |
768 KB |
Ok |
33 |
Correct |
19 ms |
2304 KB |
Ok |
34 |
Correct |
1 ms |
384 KB |
Ok |
35 |
Correct |
0 ms |
384 KB |
Ok |
36 |
Correct |
1 ms |
384 KB |
Ok |
37 |
Correct |
0 ms |
384 KB |
Ok |
38 |
Correct |
90 ms |
7928 KB |
Ok |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
93 ms |
7928 KB |
Ok |
2 |
Correct |
195 ms |
15728 KB |
Ok |
3 |
Correct |
228 ms |
15952 KB |
Ok |
4 |
Correct |
10 ms |
1280 KB |
Ok |
5 |
Correct |
1 ms |
384 KB |
Ok |
6 |
Correct |
19 ms |
2228 KB |
Ok |
7 |
Correct |
202 ms |
15752 KB |
Ok |
8 |
Correct |
1 ms |
384 KB |
Ok |
9 |
Correct |
0 ms |
384 KB |
Ok |
10 |
Correct |
1 ms |
384 KB |
Ok |
11 |
Correct |
42 ms |
4088 KB |
Ok |
12 |
Correct |
93 ms |
7940 KB |
Ok |