#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++)
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++)
{
b = temp[i];
output(b);
}
}
Compilation message
encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:22:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
for(i=0; i<N*4; i++)
^~~
encoder.cpp:24: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 |
1 |
Correct |
4 ms |
816 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
1736 KB |
Output is correct |
2 |
Correct |
8 ms |
1896 KB |
Output is correct |
3 |
Correct |
6 ms |
2056 KB |
Output is correct |
4 |
Correct |
6 ms |
2056 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
2088 KB |
Output is correct |
2 |
Correct |
8 ms |
2104 KB |
Output is correct |
3 |
Correct |
5 ms |
2216 KB |
Output is correct |
4 |
Correct |
4 ms |
2224 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
2296 KB |
Output is correct |
2 |
Correct |
7 ms |
2328 KB |
Output is correct |
3 |
Incorrect |
6 ms |
2328 KB |
Error : Bad encoded integer |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
2440 KB |
Output is correct - P = 4.000000 |
2 |
Incorrect |
4 ms |
2440 KB |
Error : Bad encoded integer |
3 |
Incorrect |
4 ms |
2440 KB |
Error : Bad encoded integer |
4 |
Incorrect |
4 ms |
2440 KB |
Error : Bad encoded integer |
5 |
Incorrect |
4 ms |
2440 KB |
Error : Bad encoded integer |
6 |
Incorrect |
5 ms |
2440 KB |
Error : Bad encoded integer |
7 |
Incorrect |
4 ms |
2440 KB |
Error : Bad encoded integer |