# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
41557 | pica4500 | cmp (balkan11_cmp) | C++98 | 1832 ms | 83948 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"
//91점 비벼욧---!!!
//3bit compression
int getIdx(int n, int kth) {
n >>= (kth * 3 - 3);
n %= 8;
return (10000 + (kth * 8) - 7 + n);
}
void remember(int n) {
for (int i = 4; 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 = 2; i > 0; i--) {
int idx = getIdx(b, i);
if (bit_get(idx)) continue;
int c = (((idx - 10000) - 1) % 8) + 1;
if (c < 5) {
for (int i = c - 1; i > 0; i--)
if (bit_get(idx - (c - i))) return 1;
return -1;
}
else {
for (int i = c + 1; i < 9; i++)
if (bit_get(idx + (i - c))) return -1;
return 1;
}
}
return 0;
}
else {
for (int i = 4; i > 2; i--) {
int idx = getIdx(b, i);
if (bit_get(idx)) continue;
int c = (((idx - 10000) - 1) % 8) + 1;
if (c < 5) {
for (int i = c - 1; i > 0; i--)
if (bit_get(idx - (c - i))) return 1;
return -1;
}
else {
for (int i = c + 1; i < 9; i++)
if (bit_get(idx + (i - c))) return -1;
return 1;
}
}
return 0;
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |