# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
17476 | Namnamseo | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++98 | 3985 ms | 25684 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 c[30][30];
void build_table() {
int i,j;
c[0][0]=1;
for(i=1;i<30;++i){
c[i][0]=1; c[i][i]=1;
for(j=1;j<i;++j) c[i][j]=c[i-1][j-1]+c[i-1][j];
}
}
void build_array(int value,bool chk[12]){
int i;
for(i=0;i<12;++i) chk[i]=0;
int now_left = 6;
for(i=0;i<12;++i){
if(value > c[11-i][now_left]){
value -= c[11-i][now_left--];
chk[i]=1;
}
}
}
int encode (int n, int x, int y) {
build_table();
bool ax[12], ay[12];
build_array(x,ax);
build_array(y,ay);
int i;
for(i=0;i<12;++i) if(ax[i] && !ay[i]) return i+1;
return -1;
}
int c[30][30];
void build_table() {
int i,j;
c[0][0]=1;
for(i=1;i<30;++i){
c[i][0]=1; c[i][i]=1;
for(j=1;j<i;++j) c[i][j]=c[i-1][j-1]+c[i-1][j];
}
}
void build_array(int value,bool chk[12]){
int i;
for(i=0;i<12;++i) chk[i]=0;
int now_left = 6;
for(i=0;i<12;++i){
if(value > c[11-i][now_left]){
value -= c[11-i][now_left--];
chk[i]=1;
}
}
}
int decode (int n, int q, int h) {
build_table();
bool qt[12];
build_array(q,qt);
return qt[h-1];
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |