# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1236243 | kaiboy | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++20 | 718 ms | 39808 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--;
int h = 0;
while (ka >> h & 1 || !(kb >> h & 1))
h++;
return 11 + h;
}
bool decode(int n, int c, int x) {
if (x <= 10) {
int h = x - 1;
return c >> h & 1;
}
int h = x - 11, k = 0;
for (int h = 0; h < 10; h++)
if (c >> h & 1)
k++;
k--;
return !(k >> h & 1);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |