Submission #1087506

#TimeUsernameProblemLanguageResultExecution timeMemory
1087506juicyQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++17
100 / 100
2331 ms24564 KiB
#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 timeMemoryGrader output
Fetching results...