Submission #525172

#TimeUsernameProblemLanguageResultExecution timeMemory
525172DeepessonQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++17
0 / 100
0 ms520 KiB
#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 timeMemoryGrader output
Fetching results...