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[])
{
if(N<=32)
{
int a=0;
for(int i=0; i<N; i++)
{
int y=M[i];
for(int j=a;j<=a+7;j++)
{
if(y%2==1)
send(j);
y/=2;
}
a+=8;
}
}
else
{
int a=0;
for(int i=0; i<N; i++)
{
int y=M[i];
for(int j=a;j<=a+3;j++)
{
for(int t=1;t<=y%4;t++)
send(j);
y/=4;
}
a+=4;
}
}
}
#include "decoder.h"
#include "decoderlib.h"
int v[300];
void decode(int N, int L, int X[])
{
if(N<=32)
{
for(int i=0;i<=255;i++)
v[i]=0;
for(int i=0; i<L; i++)
v[X[i]]++;
int a=0;
for(int i=0;i<N;i++)
{
int b=0;
int p=1;
for(int j=a;j<=a+7;j++)
{
b+=p*v[j];
p*=2;
}
output(b);
a+=8;
}
}
else
{
for(int i=0;i<=255;i++)
v[i]=0;
for(int i=0; i<L; i++)
v[X[i]]++;
int a=0;
for(int i=0;i<N;i++)
{
int b=0;
int p=1;
for(int j=a;j<=a+3;j++)
{
b+=p*v[j];
p*=4;
}
output(b);
a+=4;
}
}
}
# | 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... |