# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
41556 | pica4500 | cmp (balkan11_cmp) | C++98 | 1825 ms | 83960 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"
//82점 비벼욧---!!!
//2bit compression
int getIdx(int n, int kth) {
kth *= 2; //2kth Idx
n >>= (kth - 2);
n %= 4;
return (10000 + (kth * 2) - 3 + n);
}
void remember(int n) {
for (int i = 6; i > 0; i--) bit_set(getIdx(n, i));
int up = (n >> 6) + 1;
bit_set(100 + up);
}
int compare(int b) {
int up = (b >> 6) + 1;
if (bit_get(100 + up)) {
for (int i = 3; i > 0; i--) {
int idx = getIdx(b, i);
if (bit_get(idx)) continue;
int c = (((idx - 10000) - 1) % 4) + 1;
switch(c) {
case 1:
return -1;
case 2:
if (bit_get(idx - 1)) return 1;
return -1;
case 3:
if (bit_get(idx + 1)) return -1;
return 1;
case 4:
return 1;
}
}
return 0;
}
else {
for (int i = 6; i > 3; i--) {
int idx = getIdx(b, i);
if (bit_get(idx)) continue;
int c = (((idx - 10000) - 1) % 4) + 1;
switch (c) {
case 1:
return -1;
case 2:
if (bit_get(idx - 1)) return 1;
return -1;
case 3:
if (bit_get(idx + 1)) return -1;
return 1;
case 4:
return 1;
}
}
return 0;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |