# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1236262 | kaiboy | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++20 | 712 ms | 39604 KiB |
// coached by rainboy
int encode(int n, int a, int b) {
static int *aa = new int[n];
static bool inited;
if (!inited) {
int *kk = new int[1 << 12];
kk[0] = 0;
for (int a = 1, i = 0; i < n; i++) {
while ((kk[a] = kk[a & a - 1] + 1) != 6)
a++;
aa[i] = a++;
}
delete[] kk;
inited = true;
}
a = aa[a - 1], b = aa[b - 1];
int h = 0;
while (!(a >> h & 1) || b >> h & 1)
h++;
return h + 1;
}
// coached by rainboy
bool decode(int n, int c, int h) {
static int *aa = new int[n];
static bool inited;
if (!inited) {
int *kk = new int[1 << 12];
kk[0] = 0;
for (int a = 1, i = 0; i < n; i++) {
while ((kk[a] = kk[a & a - 1] + 1) != 6)
a++;
aa[i] = a++;
}
delete[] kk;
inited = true;
}
c = aa[c - 1], h--;
return c >> h & 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |