Submission #567264

# Submission time Handle Problem Language Result Execution time Memory
567264 2022-05-23T09:51:30 Z 600Mihnea Question (Grader is different from the original contest) (CEOI14_question_grader) C++17
100 / 100
3302 ms 24120 KB
bool first = 1;
int what[1 << 12];

int encode (int n, int x, int y) {
  if (first) {
    int id = 0;
    first = 0;
    for (int mask = 0; mask < (1 << 12); mask++) {
      if (__builtin_popcount(mask) == 6) {
        what[id++] = mask;
      }
    }
  }
  for (int bit = 0; bit < 12; bit++) {
    if (!!(what[x] & (1 << bit)) && !(what[y] & (1 << bit))) {
      return bit + 1;
    }
  }
}
bool first2 = 1;
int what2[1 << 12];

int decode (int n, int q, int h) {
  if (first2) {
    int id = 0;
    first2 = 0;
    for (int mask = 0; mask < (1 << 12); mask++) {
      if (__builtin_popcount(mask) == 6) {
        what2[id++] = mask;
      }
    }
  }
  return !!(what2[q] & (1 << (h - 1)));
}

Compilation message

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:19:1: warning: control reaches end of non-void function [-Wreturn-type]
   19 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 3302 ms 24072 KB Output is correct - maxh = 12
2 Correct 3173 ms 24120 KB Output is correct - maxh = 12