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 <iostream>
using namespace std;
int sum[10];
void encode(int n, int m[])
{
sum[0]=1;
for(int i=1;i<8;i++)sum[i]=sum[i-1]*2;
for(int i=0; i<n; i++)
{
int now[10];
for(int j=0;j<10;j++)now[j]=0;
int p=0,t=m[i];
while(t>0)
{
if(t%2==1)now[p]=1;
t/=2;
p++;
}
for(int j=0;j<4;j++)
{
int tmp=0;
if(i<16)
{
send(now[j*2]+now[j*2+1]*2+j*4+i*16);
}
else
{
send(now[j*2]+now[j*2+1]*2+j*4+(i-16)*16);
send(now[j*2]+now[j*2+1]*2+j*4+(i-16)*16);
}
}
//cout<<endl;
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <iostream>
using namespace std;
int num[256],n,l,point,x,ans[256];;
int find(int e)
{
int tmpnum=0;
x=e%4;
tmpnum=(e%16)/4;
x=x<<(tmpnum*2);
point=e/16;
}
void decode(int N, int L, int X[])
{
n=N,l=L;
for(int i=0;i<256;i++)num[i]=0;
for(int i=0;i<256;i++)ans[i]=0;
for(int i=0;i<l;i++)num[X[i]]++;
for(int i=0;i<256;i++)
{
if(num[i]==1)
{
find(i);
ans[point]+=x;
}
else if(num[i]==2)
{
find(i);
ans[point+16]+=x;
}
else if(num[i]==3)
{
find(i);
ans[point]+=x;
ans[point+16]+=x;
}
if(num[i]!=0)
{
//cout<<num[i]<<" "<<i<<" "<<point<<" "<<x<<endl;
}
}
for(int j=0;j<n;j++)
{
output(ans[j]);
}
}
Compilation message (stderr)
encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:24:8: warning: unused variable 'tmp' [-Wunused-variable]
int tmp=0;
^~~
decoder.cpp: In function 'int find(int)':
decoder.cpp:13:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
# | 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... |