Submission #772949

#TimeUsernameProblemLanguageResultExecution timeMemory
772949petezaParrots (IOI11_parrots)C++14
52 / 100
3 ms1064 KiB
#include "encoder.h" #include "encoderlib.h" #include "vector" #include "iostream" void encode(int N, int M[]) { bool before[20*N] = {}; int tosend[10*N] = {}; for(int i=0;i<N;i++) { for(int j=0;j<8;j++) { before[i*8+j] = (M[i] & (1 << j)); //std::cout << before[i*8+j]; } } int cur = 0, idx = 0; for(int i=0;i<8*N;i++) { if(before[i]) cur++; else tosend[idx++] = cur; } tosend[idx++] = cur; for(int i=0; i<idx; i++) { //std::cout << tosend[i] << ' '; send(tosend[i]); } //std::cout << '\n'; }
#include "decoder.h" #include "decoderlib.h" #include "algorithm" #include "iostream" void decode(int N, int L, int X[]) { std::sort(X, X+L); bool before[20*N] = {}; int idx = 0, last = 0; for(int i=0;i<L;i++) { while(last != X[i]) {before[idx++] = 1; last++;} before[idx++] = 0; //std::cout << X[i]; } for(int i=0;i<N;i++) { int sum = 0; for(int j=0;j<8;j++) { if(before[i*8+j]) sum += (1 << j); } //std::cout << sum << ' '; output(sum); } }
#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...