#include "encoder.h"
#include "encoderlib.h"
void encode(int N, int M[])
{
int a=0,q=0,inv=0;
for(int i=0; i<N; i++)
{
int y=M[i];
for(int j=a;j<=a+3;j++)
{
q+=y%4;
y/=4;
}
a+=4;
}
if(q>6*N)
{
inv=1;
for(int i=1;i<=4;i++)
send(0);
}
a=0;
for(int i=0; i<N; i++)
{
int y=M[i];
for(int j=a;j<=a+3;j++)
{
if(inv==0)
for(int t=1;t<=y%4;t++)
send(j);
else
for(int t=1;t<=3-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[])
{
for(int i=0;i<=255;i++)
v[i]=0;
for(int i=0; i<L; i++)
v[X[i]]++;
if(v[0]>=4)
{
v[0]-=4;
for(int i=0;i<=255;i++)
v[i]=3-v[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;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
740 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2008 KB |
Output is correct |
2 |
Correct |
7 ms |
2008 KB |
Output is correct |
3 |
Correct |
8 ms |
2120 KB |
Output is correct |
4 |
Correct |
10 ms |
2160 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2192 KB |
Output is correct |
2 |
Correct |
7 ms |
2208 KB |
Output is correct |
3 |
Correct |
7 ms |
2248 KB |
Output is correct |
4 |
Correct |
8 ms |
2256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
2264 KB |
Output is correct |
2 |
Correct |
8 ms |
2304 KB |
Output is correct |
3 |
Correct |
9 ms |
2360 KB |
Output is correct |
4 |
Correct |
10 ms |
2360 KB |
Output is correct |
5 |
Correct |
10 ms |
2360 KB |
Output is correct |
6 |
Correct |
11 ms |
2368 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
7 ms |
2368 KB |
Output is partially correct - P = 6.187500 |
2 |
Partially correct |
12 ms |
2368 KB |
Output is partially correct - P = 6.093750 |
3 |
Partially correct |
10 ms |
2408 KB |
Output is partially correct - P = 6.090909 |
4 |
Partially correct |
13 ms |
2424 KB |
Output is partially correct - P = 6.020000 |
5 |
Partially correct |
15 ms |
2704 KB |
Output is partially correct - P = 6.033333 |
6 |
Partially correct |
20 ms |
2728 KB |
Output is partially correct - P = 6.047619 |
7 |
Partially correct |
17 ms |
2728 KB |
Output is partially correct - P = 6.031250 |