# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
43874 | kdk8361 | cmp (balkan11_cmp) | C++17 | 1995 ms | 82548 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"
// >> 8 & 15
// >> 5 & 7
// >> 2 & 7
// & 3
int shif[4] = { 8,5,2,0 };
int bi[4] = { 15,7,7,3 };
int base[4] = { 21,13,5,1 };
void remember(int n) {
//edit this
for (int i = 0; i < 4; i++)
bit_set(base[i] + ((n >> shif[i]) & bi[i]));
}
int compare(int b) {
//edit this
int cur[4] = { 0, };
for (int i = 0; i < 4; i++) {
cur[i] = (b >> shif[i]) & bi[i];
}
for (int i = 0; i < 4; i++) {
if (bit_get(base[i] + cur[i])) continue;
// cur[i] > half
// l = cur[i] + 1, r = max
// 여기서 1을 찾으면 a>b
if (cur[i] > bi[i] / 2) {
int l = base[i] + cur[i] + 1, r = base[i] + bi[i];
for (; l <= r; l++) {
if (bit_get(l)) return -1;
}
return 1;
}
// cur[i] <= half
// l = 0, r = cur[i]
// 여기서 1을 찾으면 b>a
int l = base[i] + 0, r = base[i] + cur[i] - 1;
for (; l <= r; l++) {
if (bit_get(l)) return 1;
}
return -1;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |