# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
400875 | phathnv | cmp (balkan11_cmp) | C++11 | 2005 ms | 102188 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"
#include <cassert>
using namespace std;
void remember(int n) {
n += 4096;
while (n > 1){
bit_set(n);
n /= 4;
}
}
int compare(int b) {
b += 4096;
int lo = 0;
int hi = 6;
int same = 1;
int rem = 0;
while (lo <= hi){
int mid = (lo + hi) / 2;
if (!bit_get(b >> (mid * 2)) && mid != 6) {
lo = mid + 1;
rem = b >> (mid * 2);
same = 0;
}
else { hi = mid - 1;}
}
if (same) return 0;
if (rem % 4 == 0){
return -1;
}
else if (rem % 4 == 1){
int ask1 = rem / 4 * 4 + 0;
int ask2 = rem / 4 * 4 + 3;
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;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |