Submission #370893

# Submission time Handle Problem Language Result Execution time Memory
370893 2021-02-25T02:16:18 Z casperwang "The Lyuboyn" code (IZhO19_lyuboyn) C++14
100 / 100
377 ms 5872 KB
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define pii pair<int,int>
#define ff first
#define ss second
using namespace std;
#define debug(args...) kout("[ " + string(#args) + " ]", args)
void kout() { cerr << endl; }
template <class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ',kout(b...); }
template <class T> void pary(T L, T R) { while (L != R) cerr << *L << " \n"[++L==R]; }
 
int N, K, T;
string S;
int now;
vector <int> arr;
vector <bool> vis;
 
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  cin >> N >> K >> T >> S;
  for (int i = 0; i < (1<<N); i++) {
    if (__builtin_popcount(i) == K)
      arr.pb(i);
  }
  if (K % 2 == 0) {
    cout << -1 << '\n';
    return 0;
  }
  cout << (1<<N) << '\n';
  vis.resize(1<<N);
  for (int i = N-1; i >= 0; i--)
    now += (1<<i) * (S[i] == '1');
  for (int i = 0; i < (1<<N); i++) {
    for (int j = 0; j < N; j++)
      cout << (((1<<j)&now)>0);
    cout << '\n';
    vis[now] = true;
    for (int j : arr) {
      if (!vis[now ^ j]) {
        now ^= j;
        break;
      }
    }
  }
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 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 748 KB Ok
4 Correct 1 ms 364 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 0 ms 364 KB Ok
7 Correct 1 ms 364 KB Ok
8 Correct 1 ms 508 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 377 ms 5504 KB Ok
2 Correct 142 ms 2668 KB Ok
3 Correct 1 ms 364 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 8 ms 492 KB Ok
3 Correct 149 ms 2924 KB Ok
4 Correct 67 ms 1516 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 2 ms 364 KB Ok
7 Correct 34 ms 876 KB Ok
8 Correct 1 ms 364 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 303 ms 5872 KB Ok
2 Correct 306 ms 5524 KB Ok
3 Correct 304 ms 5440 KB Ok
4 Correct 143 ms 3184 KB Ok
5 Correct 144 ms 2924 KB Ok
6 Correct 67 ms 1772 KB Ok
7 Correct 68 ms 1516 KB Ok
8 Correct 32 ms 876 KB Ok
9 Correct 32 ms 1004 KB Ok
10 Correct 15 ms 620 KB Ok
11 Correct 1 ms 364 KB Ok
12 Correct 2 ms 364 KB Ok
13 Correct 1 ms 364 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 377 ms 5504 KB Ok
2 Correct 142 ms 2668 KB Ok
3 Correct 1 ms 364 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 8 ms 492 KB Ok
8 Correct 149 ms 2924 KB Ok
9 Correct 67 ms 1516 KB Ok
10 Correct 1 ms 364 KB Ok
11 Correct 2 ms 364 KB Ok
12 Correct 34 ms 876 KB Ok
13 Correct 1 ms 364 KB Ok
14 Correct 303 ms 5872 KB Ok
15 Correct 306 ms 5524 KB Ok
16 Correct 304 ms 5440 KB Ok
17 Correct 143 ms 3184 KB Ok
18 Correct 144 ms 2924 KB Ok
19 Correct 67 ms 1772 KB Ok
20 Correct 68 ms 1516 KB Ok
21 Correct 32 ms 876 KB Ok
22 Correct 32 ms 1004 KB Ok
23 Correct 15 ms 620 KB Ok
24 Correct 1 ms 364 KB Ok
25 Correct 2 ms 364 KB Ok
26 Correct 1 ms 364 KB Ok
27 Correct 304 ms 5356 KB Ok
28 Correct 146 ms 2832 KB Ok
29 Correct 303 ms 5744 KB Ok
30 Correct 17 ms 620 KB Ok
31 Correct 1 ms 364 KB Ok
32 Correct 7 ms 492 KB Ok
33 Correct 34 ms 876 KB Ok
34 Correct 1 ms 364 KB Ok
35 Correct 1 ms 364 KB Ok
36 Correct 1 ms 364 KB Ok
37 Correct 1 ms 364 KB Ok
38 Correct 144 ms 2932 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 140 ms 2796 KB Ok
2 Correct 317 ms 5484 KB Ok
3 Correct 301 ms 5744 KB Ok
4 Correct 15 ms 620 KB Ok
5 Correct 1 ms 364 KB Ok
6 Correct 32 ms 876 KB Ok
7 Correct 301 ms 5612 KB Ok
8 Correct 1 ms 364 KB Ok
9 Correct 1 ms 364 KB Ok
10 Correct 1 ms 364 KB Ok
11 Correct 69 ms 1516 KB Ok
12 Correct 144 ms 2848 KB Ok