# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1236236 | kaiboy | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++20 | 727 ms | 39748 KiB |
int encode(int n, int a, int b) {
if ((a & b) != a) {
int h = 0;
while (!(a >> h & 1) || b >> h & 1)
h++;
return h + 1;
}
int ka = 0, kb = 0;
for (int h = 0; h < 10; h++) {
if (a >> h & 1)
ka++;
if (b >> h & 1)
kb++;
}
ka--, kb--;
if (ka % 3 != kb % 3)
return 11 + ka % 3;
return 14 + ka / 3;
}
bool decode(int n, int c, int x) {
if (x <= 10) {
int h = x - 1;
return c >> h & 1;
}
int k = 0;
for (int h = 0; h < 10; h++)
if (c >> h & 1)
k++;
k--;
if (x <= 13)
return k % 3 == x - 11;
return k / 3 == x - 14;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |