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[])
{
for(int i = 0; i < N; i += 2) {
int pos = i >> 1;
int x = M[i], y = (i + 1 == N) ? 0 : M[i + 1];
for(int t = 8; t--; ) {
int cnt = (x >> t & 1) | ((y >> t & 1) << 1);
while(cnt--) {
send((t << 5) | pos);
}
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <cstring>
int cnt[8][100], res[100];
void decode(int N, int L, int X[])
{
memset(cnt, 0, sizeof(cnt));
for(int i = 0; i < L; ++i) {
++cnt[X[i] >> 5][X[i] & 31];
}
memset(res, 0, sizeof(res));
for(int t = 8; t--; ) {
for(int i = (N - 1) >> 1; i >= 0; --i) {
if(cnt[t][i] & 1) {
res[i << 1] |= 1 << t;
}
if(cnt[t][i] >> 1 & 1) {
res[i << 1 | 1] |= 1 << t;
}
}
}
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... |