Submission #114166

#TimeUsernameProblemLanguageResultExecution timeMemory
114166mosesmayerQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++17
100 / 100
1318 ms80496 KiB
int encode (int n, int x, int y) { static int cnt = 0; static int tbl[1000]; if (cnt == 0){ for (int i = 0; i < (1<<12); i++){ if (__builtin_popcount(i) == 6){ tbl[++cnt] = i; if (cnt == 920) break; } } } int xx = tbl[x], yy = tbl[y]; for (int i = 0; i < 12; i++){ if (((xx >> i) & 1) == 1 && ((yy>>i)&1) == 0){ return i + 1; } } return (x + y) % 2; }
int decode (int n, int q, int h) { static int cnt = 0; static int tbl[1000]; if (cnt == 0){ for (int i = 0; i < (1<<12); i++){ if (__builtin_popcount(i) == 6){ tbl[++cnt] = i; if (cnt == 920) break; } } } int num = tbl[q]; --h; return (num>>h)&1; }
#Verdict Execution timeMemoryGrader output
Fetching results...