This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define x first
#define y second
#define pii pair<int,int>
using namespace std;
using ll=long long;
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define eb emplace_back
#define all(a) begin(a),end(a)
const int N=300010,MOD=1e9+7;
const char en='\n';
const ll LLINF=1ll<<60;
int k,n,t;
string s;
void flip(vi v)
{
for (auto a: v) s[a]^=1;
cout<<s<<en;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cin>>n>>k>>t>>s;
if (k%2==0)
{
cout<<-1<<en;
exit(0);
}
cout<<(1<<n)<<en<<s<<en;
for (int i=0;i<(1<<(n-k-1));++i)
{
if (i)
{
vi v;
v.pb(k+1+__builtin_ctz(i));
for (int j=0;j<k-1;++j) v.pb(j);
flip(v);
}
for (int j=1;j<(1<<(k+1));++j)
{
int av=__builtin_ctz(j);
vi v;
for (int z=0;z<=k;++z) if (z!=av) v.pb(z);
flip(v);
}
}
}
# | 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... |