# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
130278 | howard1005 | cmp (balkan11_cmp) | C++14 | 2194 ms | 105080 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"
typedef struct _bitr{
int min, max, idx1, idx2;
}; _bitr bitr[10240];
void remember(int n) {
int ntmp = n;
int bi[12] = { 0, };
int i = 0, sum = 0;
while (ntmp){
if (ntmp % 2){
bi[i] = 1;
sum++;
}
i++;
ntmp /= 2;
}
int bi_rev[12];
for (int a = 0; a < 12; a++) bi_rev[a] = bi[11 - a];
int idx = 1;
for (int a = 0; a < 12; a++){
if (bi_rev[a]){
idx = 2 * idx + 1;
bit_set(idx);
}
else{
idx = 2 * idx;
bit_set(idx);
}
}
}
int compare(int b) {
int l = 1, r = 12, m, c, same = 0;
while (l <= r){
m = (l + r) / 2;
c = (b >> (12 - m)) | (1 << m);
if (bit_get(c)){
same = m;
l = m + 1;
}
else{
r = m - 1;
}
}
if (same == 12) return 0;
else if ((b >> (11 - same)) & 1) return 1;
else return -1;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |