# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
370161 | arnold518 | cmp (balkan11_cmp) | C++14 | 9078 ms | 105068 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;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
int A, B;
void remember(int _A)
{
A=_A;
vector<int> V;
for(int i=11; i>=0; i--)
{
if(A&(1<<i)) V.push_back(1);
else V.push_back(0);
}
int val=0;
for(int i=0; i<V.size(); i++)
{
val=val*2+V[i];
int t=(1<<(i+1))-1;
bit_set(t+val);
}
}
int compare(int _B)
{
B=_B;
vector<int> V, VV;
for(int i=11; i>=0; i--)
{
if(B&(1<<i)) V.push_back(1);
else V.push_back(0);
}
int val=0;
for(int i=0; i<V.size(); i++)
{
val=val*2+V[i];
VV.push_back(val);
}
int lo=-1, hi=12;
while(lo+1<hi)
{
int mid=lo+hi>>1;
int t=(1<<(mid+1))-1;
if(bit_get(t+VV[mid])) lo=mid;
else hi=mid;
}
if(hi==12) return 0;
if(V[hi]) return 1;
else return -1;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |