답안 #762814

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
762814 2023-06-21T19:53:22 Z NK_ "The Lyuboyn" code (IZhO19_lyuboyn) C++17
100 / 100
23 ms 6356 KB
// Success consists of going from failure to failure without loss of enthusiasm
#include <bits/stdc++.h>

using namespace std;

#define nl '\n'
using str = string;

template<class T> using V = vector<T>;

int main() {
	cin.tie(0)->sync_with_stdio(0);

	int N, K, T; cin >> N >> K >> T;
	str S; cin >> S;

	if (K % 2 == 0) {
		cout << -1 << nl;
		return 0;
	}

	V<pair<int, int>> A;
	for(int x = 0; x < (1 << N); x++) if (__builtin_popcount(x) == K) {
		pair<int, int> cur = {x, x};
		for(auto p : A) cur.first = min(cur.first, p.first ^ cur.first);
		if (!cur.first) continue;


		for(int i = 0; i <= int(size(A)); i++) if (i == int(size(A)) || cur.first > A[i].first) {
			A.insert(begin(A) + i, cur);
			break;
		}
	}

	// cout << 1 << endl;

	V<int> dif(1<<N);
	for(int i = 0; i < N; i++) for(int j = (1 << i); j < (1 << N); j += (2 << i)) dif[j] = A[i].second;

	cout << (1 << N) << nl;
	for(int i = 0; i < (1 << N); i++) {
		for(int j = 0; j < N; j++) if ((dif[i] >> j) & 1) S[j] = '0' + '1' - S[j];
		cout << S << nl;
	}

	
    return 0;
}


# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Ok
2 Correct 0 ms 212 KB Ok
3 Correct 0 ms 212 KB Ok
4 Correct 0 ms 212 KB Ok
5 Correct 0 ms 212 KB Ok
6 Correct 1 ms 212 KB Ok
7 Correct 0 ms 212 KB Ok
8 Correct 0 ms 212 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 6356 KB Ok
2 Correct 9 ms 3156 KB Ok
3 Correct 1 ms 212 KB Ok
4 Correct 0 ms 212 KB Ok
5 Correct 0 ms 212 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Ok
2 Correct 1 ms 468 KB Ok
3 Correct 9 ms 3156 KB Ok
4 Correct 4 ms 1620 KB Ok
5 Correct 0 ms 212 KB Ok
6 Correct 0 ms 340 KB Ok
7 Correct 3 ms 980 KB Ok
8 Correct 0 ms 212 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 18 ms 6300 KB Ok
2 Correct 18 ms 6300 KB Ok
3 Correct 17 ms 6312 KB Ok
4 Correct 9 ms 3156 KB Ok
5 Correct 9 ms 3156 KB Ok
6 Correct 4 ms 1620 KB Ok
7 Correct 4 ms 1604 KB Ok
8 Correct 2 ms 980 KB Ok
9 Correct 2 ms 980 KB Ok
10 Correct 1 ms 596 KB Ok
11 Correct 0 ms 212 KB Ok
12 Correct 0 ms 212 KB Ok
13 Correct 0 ms 212 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 6356 KB Ok
2 Correct 9 ms 3156 KB Ok
3 Correct 1 ms 212 KB Ok
4 Correct 0 ms 212 KB Ok
5 Correct 0 ms 212 KB Ok
6 Correct 0 ms 212 KB Ok
7 Correct 1 ms 468 KB Ok
8 Correct 9 ms 3156 KB Ok
9 Correct 4 ms 1620 KB Ok
10 Correct 0 ms 212 KB Ok
11 Correct 0 ms 340 KB Ok
12 Correct 3 ms 980 KB Ok
13 Correct 0 ms 212 KB Ok
14 Correct 18 ms 6300 KB Ok
15 Correct 18 ms 6300 KB Ok
16 Correct 17 ms 6312 KB Ok
17 Correct 9 ms 3156 KB Ok
18 Correct 9 ms 3156 KB Ok
19 Correct 4 ms 1620 KB Ok
20 Correct 4 ms 1604 KB Ok
21 Correct 2 ms 980 KB Ok
22 Correct 2 ms 980 KB Ok
23 Correct 1 ms 596 KB Ok
24 Correct 0 ms 212 KB Ok
25 Correct 0 ms 212 KB Ok
26 Correct 0 ms 212 KB Ok
27 Correct 19 ms 6256 KB Ok
28 Correct 9 ms 3088 KB Ok
29 Correct 18 ms 6344 KB Ok
30 Correct 1 ms 596 KB Ok
31 Correct 0 ms 212 KB Ok
32 Correct 1 ms 468 KB Ok
33 Correct 3 ms 980 KB Ok
34 Correct 0 ms 212 KB Ok
35 Correct 0 ms 212 KB Ok
36 Correct 0 ms 212 KB Ok
37 Correct 0 ms 212 KB Ok
38 Correct 9 ms 3156 KB Ok
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 3156 KB Ok
2 Correct 22 ms 6352 KB Ok
3 Correct 23 ms 6224 KB Ok
4 Correct 1 ms 596 KB Ok
5 Correct 1 ms 212 KB Ok
6 Correct 2 ms 876 KB Ok
7 Correct 17 ms 6296 KB Ok
8 Correct 1 ms 212 KB Ok
9 Correct 0 ms 212 KB Ok
10 Correct 0 ms 212 KB Ok
11 Correct 6 ms 1620 KB Ok
12 Correct 9 ms 3156 KB Ok