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"
void encode(int N, int M[])
{
int i;
for(i=0; i<N; i++) {
int now = i + (M[i] << 4);
send(now);
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <vector>
void decode(int N, int L, int X[])
{
int i;
std::vector<int> res(N);
for(i=0; i<L; i++) {
int num = 0;
for (int j = (1 << 4); j <= X[i]; j <<= 1) {
if (j & X[i]) {
num += (j >> 4);
}
}
int idx = 0;
for (int j = 0; j < 4; ++j) {
if ((1 << j) & X[i]) {
idx += (1 << j);
}
}
// std::cout << idx << " " << num << " <- " << X[i] << "\n";
res[idx] = num;
}
for (int i = 0; i < N; ++i) {
output(res[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... |