Submission #1087506

# Submission time Handle Problem Language Result Execution time Memory
1087506 2024-09-12T19:01:09 Z juicy Question (Grader is different from the original contest) (CEOI14_question_grader) C++17
100 / 100
2331 ms 24564 KB
#include <bits/stdc++.h>

using namespace std;

namespace {
  vector<int> cnd;
}

int encode(int n, int x, int y) {
  if (!cnd.size()) {
    for (int i = 1; cnd.size() < 920; ++i) {
      if (__builtin_popcount(i) == 6) {
        cnd.push_back(i);
      }
    }
  }
  --x, --y;
  for (int i = 0; i < 12; ++i) {
    if (cnd[x] >> i & 1 && !(cnd[y] >> i & 1)) {
      return i + 1;
    }
  }
  assert(0);
  return -1;
}
#include <bits/stdc++.h>

using namespace std;

namespace {
  vector<int> cnd;
}

int decode(int n, int q, int h) {
  if (!cnd.size()) {
    for (int i = 1; cnd.size() < 920; ++i) {
      if (__builtin_popcount(i) == 6) {
        cnd.push_back(i);
      }
    }
  }
  q = cnd[q - 1];
  return q >> (h - 1) & 1;
}
# Verdict Execution time Memory Grader output
1 Correct 2331 ms 24564 KB Output is correct - maxh = 12
2 Correct 2314 ms 24560 KB Output is correct - maxh = 12