#include "encoder.h"
#include "encoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void encode(int N, int M[])
{
int n = 8;
for(int i=0;i<N;i++){
int idx = i*n + M[i] % n;
send(idx);
}
for(int i=0;i<N;i++){
int num = M[i] / n ;
int idx = i*n + N*n ;
int all = 0;
for(int j=0;j<2;j++){
int cur = ((num >> j) & 1);
all |= (cur << j);
}
idx+=all;
num = (num >> 2);
for(int j=0;j<=num;j++)
send(idx);
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int N, int L, int X[])
{
int n = 8;
vector<int> mod(N);
vector<int> mul(N);
vector<int> frq(N);
for(int i=0;i<L;i++){
if(X[i] >= n*N){
int cur = X[i] - n*N;
int idx = cur / n ;
int b = cur % n;
mul[idx] = b;
frq[idx]++;
}
else{
int idx = X[i] / n ;
int b = X[i] % n;
mod[idx] = b;
}
}
for(int i=0;i<N;i++){
frq[i]--;
frq[i] = (frq[i] << 2);
mul[i]+=frq[i];
int ans = n * mul[i] + mod[i];
output(ans);
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
752 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
2000 KB |
Output is correct |
2 |
Correct |
5 ms |
2000 KB |
Output is correct |
3 |
Correct |
5 ms |
2144 KB |
Output is correct |
4 |
Correct |
5 ms |
2176 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
2176 KB |
Output is correct |
2 |
Correct |
5 ms |
2208 KB |
Output is correct |
3 |
Correct |
6 ms |
2240 KB |
Output is correct |
4 |
Correct |
5 ms |
2240 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
2240 KB |
Output is correct |
2 |
Correct |
5 ms |
2272 KB |
Output is correct |
3 |
Incorrect |
4 ms |
2272 KB |
Error : Bad encoded integer |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
5 ms |
2272 KB |
Output is partially correct - P = 9.000000 |
2 |
Incorrect |
4 ms |
2272 KB |
Error : Bad encoded integer |
3 |
Incorrect |
4 ms |
2272 KB |
Error : Bad encoded integer |
4 |
Incorrect |
4 ms |
2272 KB |
Error : Bad encoded integer |
5 |
Incorrect |
4 ms |
2272 KB |
Error : Bad encoded integer |
6 |
Incorrect |
4 ms |
2272 KB |
Error : Bad encoded integer |
7 |
Incorrect |
4 ms |
2272 KB |
Error : Bad encoded integer |