# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
525172 | Deepesson | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++17 | 0 ms | 520 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>
int popcount(int x){
int res=0;
while(x){
res+=x&1;
x/=2;
}
return res;
}
int vals[1000];
int diferenca(int x,int y){
for(int i=0;i!=20;++i){
int a=x&(1<<i);
int b=y&(1<<i);
if(a&&!b)return i;
}
assert(0);
}
bool foi=false;
void iniciar(void)
{
if(foi)return;
foi=true;
int cur=1;
for(int i=0;i!=4096;++i){
int k = popcount(i);
if(k==6){
vals[cur]=i;
++cur;
}
}
}
int encode (int n, int x, int y) {
iniciar();
int a=vals[x],b=vals[y];
int place = diferenca(a,b);
return place;
}
#include <bits/stdc++.h>
int popcount(int x){
int res=0;
while(x){
res+=x&1;
x/=2;
}
return res;
}
int vals[1000];
int diferenca(int x,int y){
for(int i=0;i!=20;++i){
int a=x&(1<<i);
int b=y&(1<<i);
if(a&&!b)return i;
}
assert(0);
}
bool foi=false;
void iniciar(void)
{
if(foi)return;
foi=true;
int cur=1;
for(int i=0;i!=4096;++i){
int k = popcount(i);
if(k==6){
vals[cur]=i;
++cur;
}
}
}
int decode (int n, int q, int h) {
iniciar();
if(vals[q]&(1<<h)){
return 1;
}else return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |