# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
724208 | MojoLake | cmp (balkan11_cmp) | C++17 | 1387 ms | 96036 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"
#include <bits/stdc++.h>
using namespace std;
int d[6] = {1, 4097, 5121, 5377, 5441, 5457};
void remember(int x){
for(int i = 0; i < 6; ++i){
bit_set((x>>(2*i)) + d[i]);
}
}
int compare(int x){
int lo = 0, hi = 6;
while(lo < hi){
int m = (hi + lo) / 2;
int p = (x>>(2 * m)) + d[m];
if(bit_get(p))hi = m;
else lo = m + 1;
}
if(lo == 0){
return 0;
}
int p = x>>(2 * (lo-1));
int ld = p & 3;
if(ld == 0)return -1;
if(ld == 3)return 1;
if(ld == 1){
if(bit_get(4 * (x>>(2 * lo)) + d[lo-1]))return 1;
else return -1;
}
if(ld == 2){
if(bit_get(4 * (x>>(2 * lo)) + 3 + d[lo-1]))return -1;
else return 1;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |