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 <stdio.h>
#include "encoder.h"
#include "encoderlib.h"
void encode(int N, int M[])
{
int i;
int a[64];
int b, c, d, e;
for(i=0; i<N; i++)
{
b=M[i]/64;
c=(M[i]%64)/16;
d=(M[i]%16)/4;
e=M[i]%4;
a[i*4]=b+16*i;
a[i*4+1]=c+4+16*i;
a[i*4+2]=d+8+16*i;
a[i*4+3]=e+12+16*i;
}
for(i=0; i<N*4; i++)
{
printf("%d ", a[i]);
}
for(i=0; i<N*4; i++)
send(a[i]);
return;
}
#include <stdio.h>
#include "decoder.h"
#include "decoderlib.h"
int power(int n, int m)
{
int ans=1;
for(int i=0; i<m; i++)
ans=ans*n;
return ans;
}
void decode(int N, int L, int X[])
{
int i, b, temp1, temp2, temp3;
int temp[16]={};
for(i=0; i<L; i++)
{
temp1=X[i]%4;
temp2=(X[i]%16)/4;
temp3=X[i]/16;
temp[temp3]+=temp1*power(4, 3-temp2);
}
for(i=0; i<L/4; i++)
{
printf("%d ", temp[i]);
}
for(i=0; i<L/4; i++)
{
b = temp[i];
output(b);
}
}
Compilation message (stderr)
encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:26:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
for(i=0; i<N*4; i++)
^~~
encoder.cpp:28:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
return;
^~~~~~
# | 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... |