This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void encode(int N, int M[]){
int qtd_bits = 0;
for(int i = 0;(1 << i) <= N;i++) qtd_bits++;
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 = 0;
for(int i = 0;(1 << i) <= N;i++) qtd_bits++;
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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |