# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
564836 | Uzouf | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++14 | 0 ms | 0 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) {
int a=x,b=y;
for (int p=10;p>=0;p--) {
int i=0,j=0;
if (exp2(p)<=a) {
a-=exp2(p); i=1;
}
if (exp2(p)<=b) {
b-=exp2(p); j=1;
}
if (i>j) return p;
}
a=__builtin_popcount(x);
b=__builtin_popcount(y);
for (int p=5;p>=0;p--) {
int i=0,j=0;
if (exp2(p)<=a) {
a-=exp2(p); i=1;
}
if (exp2(p)<=b) {
b-=exp2(p); j=1;
}
if (i<j) return p+10;
}
}