Submission #392930

#TimeUsernameProblemLanguageResultExecution timeMemory
392930HazemParrots (IOI11_parrots)C++14
52 / 100
3 ms1028 KiB
//#include "encoder.h" #include "encoderlib.h" //#include "grader.cpp" int get_val(int x,int l,int r){ int ret1 = 0; for(int i=l;i<=r;i++) if((1<<i)&x)ret1 |= 1<<(i-l); return ret1; } void encode(int N, int M[]) { int n = N; for(int i=0;i<n;i++){ int val = i<<4; for(int j=0;j<4;j++){ int val1 = val; val1 |= j<<2; val1 |= get_val(M[i],j*2,j*2+1); send(val1); } } }
//#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; int get_val1(int x,int l,int r){ int ret1 = 0; for(int i=l;i<=r;i++) if((1<<i)&x)ret1 |= 1<<(i-l); return ret1; } void decode(int N, int L, int X[]) { sort(X,X+L); for(int i=0;i<L;i++){ //printf("%d ",X[i]); if(i%4!=0)continue; int val = 0; for(int j=i;j<i+4;j++){ val |= get_val1(X[j],0,1)<<(j-i)*2; //printf("%d ",val); } //puts(""); //printf("%d ",val); output(val); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...