# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
141231 | yys11631 | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++17 | 7092 ms | 3056 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
int encode(int N, int x, int y)
{
const int NMAX = 950;
const int BMAX = 12;
const int MSK = (1 << BMAX) - 1;
int v[MSK + 1], l = 0;
for (int msk = 0; msk < (1 << BMAX); msk++) {
int many = 0;
for (int bit = 0; bit < BMAX; bit++) {
if (msk&(1 << bit))many++;
}
if (many == 6)v[l++] = msk;
}
x--;
y--;
int X = v[x], Y = v[y] ^ MSK;
int H = X & Y;
for (int i = 0; i < BMAX; i++)
if ((H >> i) & 1)
return (i + 1);
return -1;
}
int decode(int N, int q, int h)
{
const int NMAX = 950;
const int BMAX = 12;
const int MSK = (1 << BMAX) - 1;
int v[MSK + 1], l = 0;
for (int msk = 0; msk < (1 << BMAX); msk++) {
int many = 0;
for (int bit = 0; bit < BMAX; bit++) {
if (msk&(1 << bit))many++;
}
if (many == 6)v[l++] = msk;
}
q--;
h--;
if ((v[q] >> h) & 1)return 1;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |