Submission #262257

#TimeUsernameProblemLanguageResultExecution timeMemory
262257nandonathanielParrots (IOI11_parrots)C++14
52 / 100
3 ms1536 KiB
#include "encoder.h" #include "encoderlib.h" #include "bits/stdc++.h" using namespace std; void encode(int N, int M[]) { int satu=0,nol=0; for(int i=0;i<N;i++){ for(int j=0;j<8;j++){ if((1<<j) & M[i])satu++; else nol++; } } if(satu<nol){ for(int i=0;i<N;i++){ for(int j=0;j<8;j++){ if((1<<j) & M[i])send(j*N+i); } } } else{ send(0);send(0); for(int i=0;i<N;i++){ for(int j=0;j<8;j++){ if(!((1<<j) & M[i]))send(j*N+i); } } } }
#include "decoder.h" #include "decoderlib.h" #include "bits/stdc++.h" using namespace std; int ans[16],byk[256]; void decode(int N, int L, int X[]) { memset(byk,0,sizeof(byk)); for(int i=0;i<L;i++)byk[X[i]]++; memset(ans,0,sizeof(ans)); if(byk[0]>1){ //kita masukkinnya yang mati if(byk[0]==3)ans[0]++; for(int i=1;i<256;i++){ if(byk[i])ans[i%N]|=(1<<(i/N)); } for(int i=0;i<N;i++)ans[i]=255-ans[i]; } else{ for(int i=0;i<256;i++){ if(byk[i])ans[i%N]|=(1<<(i/N)); } } for(int i=0;i<N;i++)output(ans[i]); }
#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...