#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define threesum cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(false)
#define all(a) a.begin(), a.end()
#define F first
#define S second
#define int long long
#define double long double
#define pii pair<int, int>
#define ppp pair<int, pii>
#define dout cout << fixed << setprecision(15)
#define mid ((l + r) / 2)
#define lc (2 * id)
#define rc (lc + 1)
const int maxn = 1e6 + 10, maxm = 1e3 + 10, oo = 1e18 + 10, lg = 8, sq = 350, mod = 1e9 + 7;
int n, k, t;
vector<int> ans;
string s;
void solve(int x){
if(x == 0){
ans.push_back(0);
ans.push_back(1);
return;
}
solve(x - 1);
int add = (1ll << x);
vector<int> v;
for(auto i : ans)
v.push_back(i + add);
reverse(all(v));
for(auto i : v)
ans.push_back(i);
}
void out(int x){
string s;
for (int i = 0; i < n; i++)
if(x & (1ll << i))
s.push_back('1');
else
s.push_back('0');
reverse(all(s));
cout << s << "\n";
}
signed main()
{
threesum;
cin >> n >> k >> t >> s;
solve(n - 1);
reverse(all(s));
int x = 0;
for (int i = 0; i < s.size();i++)
if (s[i] == '1')
x += (1ll << i);
cout << pow(2, n) << "\n";
for(auto i : ans)
out(i ^ x);
}
/*
4 1 0
0001
*/
# | 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... |