# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
342331 | ogibogi2004 | cmp (balkan11_cmp) | C++14 | 5214 ms | 96128 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;
void remember(int n) {
//edit this
string s="";
for(int i=0;i<6;i++)
{
s+=char('0'+n%4);
n/=4;
}
reverse(s.begin(),s.end());
int t=0;
for(int i=0;i<s.size();i++)
{
t=t*4+s[i]-'0'+1;
bit_set(t);
}
}
int compare(int b) {
//edit this
string s="";
for(int i=0;i<6;i++)
{
s+=char('0'+b%4);
b/=4;
}
reverse(s.begin(),s.end());
int t=0;
vector<int>v;
for(int i=0;i<s.size();i++)
{
t=t*4+s[i]-'0'+1;
v.push_back(t);
}
int high=s.size()-1,low=0,ans=-1;
while(low<=high)
{
int mid=(low+high)/2;
if(bit_get(v[mid]))
{
ans=mid;
low=mid+1;
}
else high=mid-1;
}
if(ans==s.size()-1)return 0;
int j=s[ans+1]-'0';
int k;
if(ans==-1)k=0;
else k=v[ans];
if(j<2)
{
for(int l=0;l<j;l++)
{
if(bit_get(k*4+l+1))return 1;
}
return -1;
}
else
{
for(int l=j+1;l<4;l++)
{
if(bit_get(k*4+l+1))return -1;
}
return 1;
}
return -1;
return 0;
return bit_get(13);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |