Submission #64524

#TimeUsernameProblemLanguageResultExecution timeMemory
64524IvanCParrots (IOI11_parrots)C++17
81 / 100
18 ms2816 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; void encode(int N, int M[]){ int qtd_bits = 5; for(int i = 0;i<N;i++){ int copia = M[i]; for(int j = 0;j<3;j++){ int primeiro = (copia & 7); copia = copia >> 3; int enviar = (i | (primeiro << qtd_bits)); for(int k = 0;k < (1 << j);k++) send(enviar); } } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; void decode(int N, int L, int X[]){ map<int,int> mapa[65]; int ANS[65]; memset(ANS,0,sizeof(ANS)); int qtd_bits = 5; for(int i = 0;i < L;i++){ int pos = X[i] & ((1 << qtd_bits) - 1); int outros_bits = (X[i] >> qtd_bits); mapa[pos][outros_bits]++; } for(int i = 0;i<N;i++){ for(auto it : mapa[i]){ int outros_bits = it.first,freq = it.second; if(freq & 1) ANS[i] += outros_bits; if(freq & 2) ANS[i] += outros_bits*8; if(freq & 4) ANS[i] += outros_bits*64; } } 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...