Submission #384515

# Submission time Handle Problem Language Result Execution time Memory
384515 2021-04-01T19:26:58 Z dorijanlendvaj "The Lyuboyn" code (IZhO19_lyuboyn) C++14
100 / 100
115 ms 5380 KB
#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
1 Correct 1 ms 364 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Ok
2 Correct 1 ms 384 KB Ok
3 Correct 1 ms 364 KB Ok
4 Correct 1 ms 364 KB Ok
5 Correct 2 ms 384 KB Ok
6 Correct 1 ms 364 KB Ok
7 Correct 1 ms 384 KB Ok
8 Correct 2 ms 364 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 44 ms 5356 KB Ok
2 Correct 21 ms 2668 KB Ok
3 Correct 1 ms 384 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 3 ms 492 KB Ok
3 Correct 30 ms 2668 KB Ok
4 Correct 15 ms 1516 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 2 ms 364 KB Ok
7 Correct 8 ms 876 KB Ok
8 Correct 1 ms 364 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 71 ms 5356 KB Ok
2 Correct 79 ms 5356 KB Ok
3 Correct 59 ms 5356 KB Ok
4 Correct 47 ms 2816 KB Ok
5 Correct 30 ms 2668 KB Ok
6 Correct 23 ms 1516 KB Ok
7 Correct 12 ms 1516 KB Ok
8 Correct 9 ms 1004 KB Ok
9 Correct 14 ms 876 KB Ok
10 Correct 5 ms 620 KB Ok
11 Correct 2 ms 364 KB Ok
12 Correct 1 ms 364 KB Ok
13 Correct 1 ms 492 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 44 ms 5356 KB Ok
2 Correct 21 ms 2668 KB Ok
3 Correct 1 ms 384 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 3 ms 492 KB Ok
8 Correct 30 ms 2668 KB Ok
9 Correct 15 ms 1516 KB Ok
10 Correct 1 ms 364 KB Ok
11 Correct 2 ms 364 KB Ok
12 Correct 8 ms 876 KB Ok
13 Correct 1 ms 364 KB Ok
14 Correct 71 ms 5356 KB Ok
15 Correct 79 ms 5356 KB Ok
16 Correct 59 ms 5356 KB Ok
17 Correct 47 ms 2816 KB Ok
18 Correct 30 ms 2668 KB Ok
19 Correct 23 ms 1516 KB Ok
20 Correct 12 ms 1516 KB Ok
21 Correct 9 ms 1004 KB Ok
22 Correct 14 ms 876 KB Ok
23 Correct 5 ms 620 KB Ok
24 Correct 2 ms 364 KB Ok
25 Correct 1 ms 364 KB Ok
26 Correct 1 ms 492 KB Ok
27 Correct 110 ms 5356 KB Ok
28 Correct 47 ms 2668 KB Ok
29 Correct 92 ms 5356 KB Ok
30 Correct 6 ms 620 KB Ok
31 Correct 1 ms 364 KB Ok
32 Correct 4 ms 492 KB Ok
33 Correct 13 ms 1024 KB Ok
34 Correct 1 ms 364 KB Ok
35 Correct 1 ms 384 KB Ok
36 Correct 1 ms 364 KB Ok
37 Correct 1 ms 364 KB Ok
38 Correct 48 ms 2668 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 54 ms 2668 KB Ok
2 Correct 115 ms 5380 KB Ok
3 Correct 93 ms 5356 KB Ok
4 Correct 8 ms 620 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 12 ms 876 KB Ok
7 Correct 68 ms 5356 KB Ok
8 Correct 1 ms 364 KB Ok
9 Correct 1 ms 364 KB Ok
10 Correct 2 ms 364 KB Ok
11 Correct 25 ms 1516 KB Ok
12 Correct 46 ms 2688 KB Ok