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<stdio.h>
void bit(int n) {
for(int i = 0; i < 8; i++)
if(n&(1<<i))
putchar('1');
else
putchar('0');
}
void encode(int N, int M[])
{
for(int i = 0; i < N; i++) {
for(int cnt = 0; cnt < 4; cnt++) {
int here = i;
here += (cnt << 6);
here += ((M[i]&(3<<(2*cnt)))<<4)>>(2*cnt);
// bit(here); putchar(' ');
send(here);
}
// puts("");
}
// puts("");
}
#include "decoder.h"
#include "decoderlib.h"
#include<cstdio>
#include<cstring>
#include<algorithm>
void opa(int n) {
for(int i = 0; i < 8; i++)
if(n&(1<<i))
putchar('1');
else
putchar('0');
}
int pos[1<<4][4], cnt[1<<4];
void decode(int N, int L, int X[])
{
memset(cnt, 0, sizeof cnt);
for(int i = 0; i < L; i++)
pos[X[i]&15][cnt[X[i]&15]++] = X[i];
for(int i = 0; i < N; i++) {
std::sort(pos[i], pos[i]+4);
int here = 0;
for(int j = 0; j < 4; j++) {
pos[i][j] >>= 4;
pos[i][j] &= 3;
// opa(pos[i][j]); putchar(' ');
// printf("%d ", pos[i][j]);
here += pos[i][j] << (2*j);
// opa(here); putchar(' ');
}
// puts("");
// printf("%d\n", here);
output(here);
}
// puts("");
}
# | 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... |