# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
147946 | evpipis | cmp (balkan11_cmp) | C++11 | 1593 ms | 82552 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"
const int lg = 12, k = 3;
int match(int pos, int num){
return pos*(1<<k) + num + 1;
}
void remember(int a) {
for (int pos = lg/k-1; pos >= 0; pos--){
int num = (a>>(k*pos))%(1<<k);
bit_set(match(pos, num));
//printf("pos = %d, num = %d, match = %d\n", pos, num, match(pos, num));
}
}
int compare(int b) {
for (int pos = lg/k-1; pos >= 0; pos--){
int num = (b>>(k*pos))%(1<<k);
if (bit_get(match(pos, num)))
continue;
if (num < (1<<k)/2){
for (int j = 0; j < num; j++)
if (bit_get(match(pos, j)))
return 1;
return -1;
}
else{
for (int j = (1<<k)-1; j > num; j--)
if (bit_get(match(pos, j)))
return -1;
return 1;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |