Submission #567264

#TimeUsernameProblemLanguageResultExecution timeMemory
567264600MihneaQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++17
100 / 100
3302 ms24120 KiB
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 (stderr)

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 timeMemoryGrader output
Fetching results...