# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
41080 | hsb154 | cmp (balkan11_cmp) | C++14 | 1814 ms | 92960 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"
void remember(int n) {
int mask = 7 << 9;
int me = 0;
int shift = 9;
for (int i = 0; mask; i++) {
me = me * 8 + ((mask&n) >> shift)+1;
bit_set(me);
shift -= 3;
mask >>= 3;
}
}
int compare(int b) {
int ret;
int mask = 7 << 9;
int shift = 9;
int me = 0;
for(int i=0;i<4;i++){
int temp_me = me * 8 + ((mask&b) >> shift) + 1;
if(bit_get(temp_me)==0){
int left = me * 8 + 1;
int right = me * 8 + 8;
if (temp_me - left < right - temp_me) {
for (int m = temp_me - 1; m >= left; m--) {
if (bit_get(m) == 1)
return 1;
}
return -1;
}
else {
for (int m = temp_me +1; m <= right; m++) {
if (bit_get(m) == 1)
return -1;
}
return 1;
}
}
me = temp_me;
mask >>= 3;
shift -= 3;
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |