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 <iostream>
void encode(int N, int M[]) {
for (int i = 0; i < N; i ++) {
int x = M[i];
int k = i;
for (int j = 8; j < 12; j ++) {
x += (k % 2) * (1 << j);
k /= 2;
}
// std::cout << x << " ";
send(x);
}
// std::cout << std::endl;
}
#include "decoder.h"
#include "decoderlib.h"
#include <vector>
#include <algorithm>
#include <iostream>
void decode(int N, int L, int X[]) {
std::vector <int> res(N);
for (int i = 0; i < N; i ++) {
int val = 0;
for (int j = 0; j < 8; j ++) {
val += (X[i] % 2) * (1 << j);
X[i] /= 2;
}
int pos = 0;
for (int j = 8; j < 12; j ++) {
pos += (X[i] % 2) * (1 << (j - 8));
X[i] /= 2;
}
res[pos] = val;
}
for (auto i: res) {
// std::cout << i << " ";
output(i);
}// std::cout << std::endl;
}
# | 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... |