Submission #770462

#TimeUsernameProblemLanguageResultExecution timeMemory
770462kad_01Parrots (IOI11_parrots)C++14
88 / 100
7 ms1364 KiB
#include "encoder.h" #include "encoderlib.h" void encode(int N, int M[]) { if (N <= 32) { for (int i = 0; i < N; i++) { for (int j = 7; j >= 0; j--) { if ((M[i] >> j) & 1) { send(8 * i + j); } } } } else { for (int i = 0; i < N; i++) { for (int j = 3; j >= 0; j--) { for (int k = 0; k < ((M[i] >> (2 * j)) & 3); k++) { send(4 * i + j); } } } } }
#include "decoder.h" #include "decoderlib.h" void decode(int N, int L, int X[]) { int freq[256]; for (int i = 0; i < 256; i++) { freq[i] = 0; } for (int i = 0; i < L; i++) { freq[X[i]]++; } if (N <= 32) { for (int i = 0; i < N; i++) { int val = 0; for (int j = 7; j >= 0; j--) { val <<= 1; val |= freq[8 * i + j]; } output(val); } } else { for (int i = 0; i < N; i++) { int val = 0; for (int j = 3; j >= 0; j--) { val <<= 2; val |= freq[4 * i + j]; } 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...