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"
int cand[] = { 128, 64, 32, 16, 8, 4, 2, 1 };
void encode(int N, int M[])
{
for (int i = 0; i < N; i++) {
// 1글자에 대해서 10개의 비트를 만든다
// 1번 비트는 위치 255 - pos;
// 2번 비트는 확인용
// 3 ~ 10은 1, 2, 4, 8, 16, 32, 64, 128
send(255 - i);
send(0);
int val = M[i];
for (int j = 0; j < 8; j++) {
if (cand[j] <= val) {
send(cand[j]);
val -= cand[j];
}
else send(0);
}
}
}
#include "decoder.h"
#include "decoderlib.h"
void decode(int N, int L, int X[])
{
if (!X[0]) {
int t, i = 0;
while (i < L - 1) {
t = X[i];
X[i] = X[i + 1];
X[i + 1] = t;
i += 2;
}
}
for (int i = 0; i < N; i++) {
int val = 0;
for (int j = 2; j < 10; j++) {
int ind = i * 10 + j;
val += X[ind];
}
output(val);
}
}
# | 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... |