# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
728010 | rainboy | cmp (balkan11_cmp) | C11 | 1883 ms | 102184 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"
#define A 4096
void remember(int a) {
for (a += A; a > 1; a >>= 2)
bit_set(a);
}
int compare(int b) {
int lower = -1, upper = 6, h;
while (upper - lower > 1) {
h = (lower + upper) / 2;
if (bit_get(A + b >> h * 2))
upper = h;
else
lower = h;
}
if (lower == -1)
return 0;
switch ((A + b >> lower * 2 & 3)) {
case 0:
return -1;
case 1:
return bit_get((A + b >> lower * 2) - 1) ? 1 : -1;
case 2:
return bit_get((A + b >> lower * 2) + 1) ? -1 : 1;
case 3:
return 1;
default:
return 0;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |