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 <bits/stdc++.h>
#define ll long long
#define pb push_back
#include "encoder.h"
#include "encoderlib.h"
//#include "parrotslib.h"
using namespace std;
const int MN = 3e5 + 5;
int xx[300005];
int vl[45][15];
void fill(){
int p = 0;
for (int i=0;i<32;i++){
for (int j=0;j<8;j++){
vl[i][j] = p++;
}
}
}
void encode(int N, int M[]){
fill();
int id = -1;
for (int i = 0; i < N; i++){
int x = M[i];
for (int j = 7; j >= 0; j--){
if (((x >> j) & 1)){
if (i < 32) xx[++id] = vl[i][j];
else {
xx[++id] = vl[i - 32][j];
xx[++id] = vl[i - 32][j];
}
}
}
}
for (int i=0;i<=id;i++)
send(xx[i]);
}
#include <bits/stdc++.h>
#include "decoder.h"
#include "decoderlib.h"
#define ll long long
#define pb push_back
//#include "parrotslib.h"
using namespace std;
//const int MN = 3e5 + 5;
int yy[300005],vl2[45][15],c[45][15];
pair <int,int> rev[315];
void fill2(){
int p = 0;
for (int i=0;i<32;i++){
for (int j=0;j<8;j++){
vl2[i][j] = p;
rev[p] = {i,j};
p++;
}
}
}
void decode(int N, int L, int X[]){
fill2();
for (int i=0;i<N;i++)
yy[i] = 0;
for (int i = 0; i < L; i++){
int x = X[i];
int A = rev[x].second,B = rev[x].first;
c[B][A]++;
}
for (int i = 0; i < 32; i++){
for (int j = 0; j < 8; j++){
if (c[i][j] >= 2) yy[i + 32] |= (1<<j);
if ((c[i][j] & 1)) yy[i] |= (1<<j);
}
}
for (int i = 0; i < 32; i++)
for (int j = 0; j < 8; j++)
c[i][j] = 0;
for (int i=0;i<N;i++)
output(yy[i]);
}
# | 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... |