#include "encoder.h"
#include "encoderlib.h"
#include "vector"
using namespace std;
void encode(int N, int M[])
{
int i;
vector <int> pos;
for(int i = 0; i < N; i++) {
for(int j = 0; j < 8; j++) {
pos.push_back((M[i] >> j) & 1);
}
}
for(size_t i = 0; i < pos.size(); i++) {
if(pos[i] == 1) {
send(i);
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include "vector"
using namespace std;
void decode(int N, int L, int X[])
{
int i, b;
vector <int> v (8 * N);
for(i=0; i<L; i++) {
b = X[i];
v[b] = 1;
}
for(int i = 0; i < N; i++) {
int num = 0;
for(int j = 0; j < 8; j++) {
num |= (1 << j) * v[8*i + j];
}
output(num);
}
}
Compilation message
encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:8:8: warning: unused variable 'i' [-Wunused-variable]
int i;
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
752 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
1592 KB |
Output is correct |
2 |
Correct |
5 ms |
1600 KB |
Output is correct |
3 |
Correct |
5 ms |
1728 KB |
Output is correct |
4 |
Correct |
6 ms |
1864 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
2064 KB |
Output is correct |
2 |
Correct |
6 ms |
2064 KB |
Output is correct |
3 |
Correct |
6 ms |
2112 KB |
Output is correct |
4 |
Correct |
6 ms |
2112 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
2176 KB |
Output is correct |
2 |
Correct |
6 ms |
2176 KB |
Output is correct |
3 |
Correct |
6 ms |
2192 KB |
Output is correct |
4 |
Correct |
8 ms |
2192 KB |
Output is correct |
5 |
Correct |
7 ms |
2192 KB |
Output is correct |
6 |
Correct |
7 ms |
2216 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
7 ms |
2216 KB |
Output is partially correct - P = 8.000000 |
2 |
Partially correct |
9 ms |
2216 KB |
Output is partially correct - P = 8.000000 |
3 |
Incorrect |
4 ms |
2216 KB |
Error : Bad encoded integer |
4 |
Incorrect |
4 ms |
2216 KB |
Error : Bad encoded integer |
5 |
Incorrect |
4 ms |
2216 KB |
Error : Bad encoded integer |
6 |
Incorrect |
4 ms |
2216 KB |
Error : Bad encoded integer |
7 |
Incorrect |
4 ms |
2216 KB |
Error : Bad encoded integer |