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[])
{
int t=0,u=0,st[1002],stt[1002];
for(int i=0;i<N;i++)
{
for(int j=0;j<M[i]/64;j++)st[t++]=i*4;
for(int j=0;j<M[i]%64/16;j++)st[t++]=i*4+1;
for(int j=0;j<M[i]%16/4;j++)st[t++]=i*4+2;
for(int j=0;j<M[i]%4;j++)st[t++]=i*4+3;
for(int j=0;j<3-M[i]/64;j++)stt[u++]=i*4;
for(int j=0;j<3-M[i]%64/16;j++)stt[u++]=i*4+1;
for(int j=0;j<3-M[i]%16/4;j++)stt[u++]=i*4+2;
for(int j=0;j<3-M[i]%4;j++)stt[u++]=i*4+3;
}
if(t<u)
{
for(int i=0;i<t;i++)send(st[i]);
}
else
{
for(int i=0;i<u;i++)send(stt[i]);
send(0);send(0);send(0);send(0);
}
}
#include "decoder.h"
#include "decoderlib.h"
void decode(int N,int L,int X[])
{
int ch[256]={};
for(int i=0;i<L;i++)ch[X[i]]++;
if(ch[0]<4)
{
for(int i=0;i<N;i++)
{
output(ch[i*4]*64+ch[i*4+1]*16+ch[i*4+2]*4+ch[i*4+3]);
}
}
else
{
ch[0]-=4;
for(int i=0;i<N;i++)
{
output((3-ch[i*4])*64+(3-ch[i*4+1])*16+(3-ch[i*4+2])*4+(3-ch[i*4+3]));
}
}
}
# | 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... |