# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
231485 | MKopchev | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++14 | 4459 ms | 48392 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 <bits/stdc++.h>
using namespace std;
int codes[1000],pointer=0;
int encode(int n,int x,int y)
{
if(pointer==0)
{
for(int i=1;pointer<=920;i++)
{
if(__builtin_popcount(i)==6)
{
pointer++;
codes[pointer]=i;
}
}
}
x=codes[x];
y=codes[y];
for(int h=0;true;h++)
if((x&(1<<h))>0&&(y&(1<<h))==0)return h+1;
return -1;
}
/*
int main()
{
cout<<encode(920,5,6)<<endl;
cout<<encode(920,1,2)<<endl;
cout<<encode(920,4,5)<<endl;
cout<<encode(920,1,2)<<endl;
cout<<encode(920,3,5)<<endl;
cout<<encode(920,4,5)<<endl;
cout<<encode(920,5,2)<<endl;
return 0;
}
*/
#include <bits/stdc++.h>
using namespace std;
int codes[1000],pointer=0;
int decode(int n,int q,int h)
{
if(pointer==0)
{
for(int i=1;pointer<=920;i++)
{
if(__builtin_popcount(i)==6)
{
pointer++;
codes[pointer]=i;
}
}
}
q=codes[q];
if((q&(1<<(h-1))))return 1;
return 0;
}
/*
int main()
{
cout<<decode(920,5,2)<<endl;
cout<<decode(920,1,6)<<endl;
cout<<decode(920,4,3)<<endl;
cout<<decode(920,2,6)<<endl;
cout<<decode(920,3,3)<<endl;
cout<<decode(920,5,3)<<endl;
cout<<decode(920,2,6)<<endl;
}
*/
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |