# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
52535 | someone_aa | cmp (balkan11_cmp) | C++17 | 1144 ms | 104988 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 <vector>
using namespace std;
void remember(int n) {
int node = 1;
for(int i=11;i>=0;i--) {
bit_set(node);
if(n&(1<<i)) node = 2 * node + 1;
else node = 2 * node;
}
bit_set(node);
}
int compare(int b) {
//edit this
int node = 1;
vector<int>nodes;
for(int i=11;i>=0;i--) {
nodes.push_back(node);
if(b&(1<<i)) node = 2 * node + 1;
else node = 2 * node;
}
nodes.push_back(node);
int li = 0, ri = nodes.size()-1;
while(li < ri) {
int mid = (li+ri)/2;
if(bit_get(mid)) ri = mid;
else li = mid - 1;
}
if(li == nodes.size() -1) return 0;
else {
if(nodes[li] * 2 == nodes[li+1]) return -1;
else return 1;
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |