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++) {
int pos = i;
int vals[3];
vals[0] = M[i] / 100;
vals[1] = (M[i] % 100) / 10;
vals[2] = M[i] % 10;
while(vals[0] != 0 || vals[1] != 0 || vals[2] != 0) {
int sendVal = pos << 2;
if(vals[0] != 0) {
vals[0]--;
} else {
if(vals[1] != 0) {
sendVal = sendVal | ( 1 << 1);
vals[1]--;
}
if(vals[2] != 0) {
sendVal = sendVal | 1;
vals[2]--;
}
}
send(sendVal);
}
}
}
#include "decoder.h"
#include "decoderlib.h"
void decode(int N, int L, int X[])
{
int result[N];
for(int i=0; i<N; i++) {
result[i] = 0;
}
for(int i=0; i<L; i++) {
int pos = X[i] >> 2;
int val = 0;
if(!(X[i] & 2) && !(X[i] & 1)) {
val = val + 100;
}
if(X[i] & 2) {
val = val + 10;
}
if(X[i] & 1) {
val = val + 1;
}
result[pos] = result[pos] + val;
}
for(int i=0; i<N; i++) {
output(result[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... |