#include "encoder.h"
#include "encoderlib.h"
int BIT_MASK[8] = {
0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
};
void encode(int N, int M[])
{
int i;
for(i=0; i<N; i++)
{
for(int j = 0; j<8; j++)
{
if(M[i]&BIT_MASK[j])
send(i*8 + j);
}
}
}
#include "decoder.h"
#include "decoderlib.h"
int BIT_MASK[8] = {
0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01
};
void decode(int N, int L, int X[])
{
int i;
int msg[32] = {0};
for(i=0; i<L; i++) {
msg[X[i]/8] |= BIT_MASK[X[i]%8];
}
for(i=0; i<N; i++) {
output(msg[i]);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
748 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
1752 KB |
Output is correct |
2 |
Correct |
6 ms |
1864 KB |
Output is correct |
3 |
Correct |
5 ms |
1936 KB |
Output is correct |
4 |
Correct |
8 ms |
2048 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
2200 KB |
Output is correct |
2 |
Correct |
5 ms |
2208 KB |
Output is correct |
3 |
Correct |
6 ms |
2240 KB |
Output is correct |
4 |
Correct |
7 ms |
2248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
2288 KB |
Output is correct |
2 |
Correct |
6 ms |
2328 KB |
Output is correct |
3 |
Correct |
7 ms |
2328 KB |
Output is correct |
4 |
Correct |
7 ms |
2336 KB |
Output is correct |
5 |
Correct |
7 ms |
2336 KB |
Output is correct |
6 |
Correct |
7 ms |
2336 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
6 ms |
2336 KB |
Output is partially correct - P = 8.000000 |
2 |
Partially correct |
7 ms |
2336 KB |
Output is partially correct - P = 8.000000 |
3 |
Incorrect |
4 ms |
2336 KB |
Error : Bad encoded integer |
4 |
Incorrect |
4 ms |
2336 KB |
Error : Bad encoded integer |
5 |
Incorrect |
6 ms |
2336 KB |
Error : Bad encoded integer |
6 |
Incorrect |
4 ms |
2336 KB |
Error : Bad encoded integer |
7 |
Incorrect |
4 ms |
2336 KB |
Error : Bad encoded integer |