# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
7148 | ainta | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++98 | 2629 ms | 25676 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.
static int C[13][13], w[13], p[13];
static void Do(int x){
int i, c = 6;
for (i = 12; i >= 1; i--){
if (x > C[i - 1][c]){
x -= C[i - 1][c];
w[i] = 1; c--;
}
else{
w[i] = 0;
}
}
}
int encode (int n, int x, int y) {
int i, j;
for (i = 0; i <= 12; i++){
C[i][0] = 1;
for (j = 1; j <= i; j++)C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
}
Do(x);
for (i = 1; i <= 12; i++)p[i] = w[i];
Do(y);
for (i = 1; i <= 12; i++)if (p[i] && !w[i])break;
return i;
}
static int C[13][13], w[13];
static void Do(int x){
int i, c = 6;
for (i = 12; i >= 1; i--){
if (x > C[i - 1][c]){
x -= C[i - 1][c];
w[i] = 1; c--;
}
else{
w[i] = 0;
}
}
}
int decode(int n, int q, int h) {
int i, j;
for (i = 0; i <= 12; i++){
C[i][0] = 1;
for (j = 1; j <= i; j++)C[i][j] = C[i - 1][j - 1] + C[i - 1][j];
}
Do(q);
if (w[h])return 1;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |