This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 num = M[i] ;
int idx = i*n;
int all = 0;
for(int j=0;j<3;j++){
int cur = ((num >> j) & 1);
all |= (cur << j);
}
idx+=all;
num = (num >> 3);
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> mul(N);
vector<int> frq(N);
for(int i=0;i<L;i++){
int cur = X[i];
int idx = cur / n ;
int b = cur % n;
mul[idx] = b;
frq[idx]++;
}
for(int i=0;i<N;i++){
frq[i]--;
frq[i] = (frq[i] << 3);
mul[i]+=frq[i];
int ans = mul[i];
output(ans);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |