Submission #257695

# Submission time Handle Problem Language Result Execution time Memory
257695 2020-08-04T14:52:34 Z BThero "The Lyuboyn" code (IZhO19_lyuboyn) C++17
14 / 100
429 ms 6488 KB
// chrono::system_clock::now().time_since_epoch().count()
#include<bits/stdc++.h>

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << " = " << x << endl;

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

vi gen(int n, int k) {
  if (k % 2 == 0) {
    return {};
  }
  
  vi ret;
  
  if (k == 1) {
    if (n == 1) {
      return vi({0, 1});
    }
    
    vi A = gen(n - 1, k);
    vi B = A;
    reverse(all(B));
    
    for (int &x : B) {
      x += (1 << (n - 1));
    }
    
    for (int x : A) {
      ret.pb(x);
    }
    
    for (int x : B) {
      ret.pb(x);
    }
    
    return ret;
  }
  
  return ret;
}

void solve() {
  int n, k, T;
  string S;
  scanf("%d %d %d", &n, &k, &T);
  cin >> S;
  int st = 0;
  
  for (int i = 0; i < n; ++i) {
    if (S[i] == '1') {
      st += (1 << i);
    }
  }
  
  vi vec = gen(n, k);
  
  if (vec.empty()) {
    printf("-1\n");
    return;
  }
  
  rotate(vec.begin(), find(all(vec), st), vec.end());
  printf("%d\n", (1 << n));
  
  for (int x : vec) {
    for (int i = 0; i < n; ++i) {
      printf("%d", (x >> i) & 1);
    }
    
    printf("\n");
  }
}

int main() {
  int tt = 1;
  
  while (tt--) {
    solve();
  }

  return 0;
}

Compilation message

lyuboyn.cpp: In function 'void solve()':
lyuboyn.cpp:55:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %d", &n, &k, &T);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Ok
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output -1 while solution exists
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Ok
2 Correct 0 ms 256 KB Ok
3 Correct 0 ms 256 KB Ok
4 Correct 1 ms 384 KB Ok
5 Correct 1 ms 256 KB Ok
6 Correct 0 ms 256 KB Ok
7 Correct 1 ms 256 KB Ok
8 Correct 1 ms 256 KB Ok
# Verdict Execution time Memory Grader output
1 Correct 429 ms 6488 KB Ok
2 Correct 202 ms 3304 KB Ok
3 Correct 2 ms 384 KB Ok
4 Correct 1 ms 256 KB Ok
5 Correct 0 ms 384 KB Ok
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output -1 while solution exists
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output -1 while solution exists
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 429 ms 6488 KB Ok
2 Correct 202 ms 3304 KB Ok
3 Correct 2 ms 384 KB Ok
4 Correct 1 ms 256 KB Ok
5 Correct 0 ms 384 KB Ok
6 Incorrect 1 ms 256 KB Output -1 while solution exists
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output -1 while solution exists
2 Halted 0 ms 0 KB -