# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
45449 | smu201111192 | cmp (balkan11_cmp) | C++17 | 1081 ms | 102232 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.
#include "cmp.h"
void remember(int n) {
n += 4096;
while (n > 1){
bit_set(n);
n /= 4;
}
}
int kth(int num,int k){
k = 6 - k;
for (int i = 0; i < k; i++){ num /= 4; }
return num;
}
int compare(int b) {
int lo = 0;
int hi = 6;
int same = 1;
while (lo <= hi){
int mid = (lo + hi) / 2;
if (bit_get(kth(b, mid)) == 1) lo = mid + 1;
else { hi = mid - 1; same = 0; }
}
if (same) return 0;
int diff_pos = lo - 1;
int rem = kth(b, diff_pos);
if (rem % 4 == 0){
return -1;
}
else if (rem % 4 == 1){
return bit_get(rem / 4 * 4 + 0) ? 1 : -1;
}
else if (rem % 4 == 2){
return bit_get(rem / 4 * 4 + 3) ? -1 : 1;
}
else{
return 1;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |