#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void encode(int N, int M[]) {
for(int i=0;i<N;i++) {
int def = i;
for(int j=0;j<8;j++) {
if(M[i] & (1<<j)) {
// on bit
//cout<<i<<", "<<M[i]<<": "<<j<<"\n";
int curr = def;
for(int bit=0;bit<3;bit++) {
if(j&(1<<bit)) {
curr |= (1<<(bit + 5));
}
}
send(curr);
}
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int N, int L, int X[]) {
int arr[35];
memset(arr,0,sizeof(arr));
for(int i=0;i<L;i++) {
int position = 0;
for(int j=0;j<5;j++) {
if(X[i] & (1<<j)) {
position |= (1<<j);
}
}
int index = 0;
for(int j=5;j<8;j++) {
if(X[i] & (1<<j)) {
index |= (1<<(j-5));
}
}
arr[position] |= (1<<index);
}
for(int i=0;i<N;i++) {
output(arr[i]);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
784 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
1536 KB |
Output is correct |
2 |
Correct |
6 ms |
1536 KB |
Output is correct |
3 |
Correct |
6 ms |
1536 KB |
Output is correct |
4 |
Correct |
8 ms |
1536 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
1536 KB |
Output is correct |
2 |
Correct |
6 ms |
1536 KB |
Output is correct |
3 |
Correct |
6 ms |
1536 KB |
Output is correct |
4 |
Correct |
6 ms |
1536 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
1536 KB |
Output is correct |
2 |
Correct |
7 ms |
1536 KB |
Output is correct |
3 |
Correct |
7 ms |
1536 KB |
Output is correct |
4 |
Correct |
8 ms |
1536 KB |
Output is correct |
5 |
Correct |
7 ms |
1536 KB |
Output is correct |
6 |
Correct |
8 ms |
1536 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
6 ms |
1536 KB |
Output is partially correct - P = 8.000000 |
2 |
Partially correct |
9 ms |
1480 KB |
Output is partially correct - P = 8.000000 |
3 |
Incorrect |
6 ms |
1536 KB |
Error : Output is wrong |
4 |
Incorrect |
7 ms |
1536 KB |
Error : Output is wrong |
5 |
Incorrect |
4 ms |
1792 KB |
Error : Output is wrong |
6 |
Incorrect |
9 ms |
1792 KB |
Error : Output is wrong |
7 |
Incorrect |
9 ms |
1792 KB |
Error : Output is wrong |