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;
#define X first
#define Y second
#define pb push_back
typedef pair<int, int> ii;
typedef long long ll;
void encode(int n, int M[])
{
vector<int> mess;
for(int i = 0; i< n; i++)
{
int x = M[i];
vector<int> tmp;
for(int j = 0; j< 8; j++)
{
tmp.pb((1<<j) & x);
}
reverse(tmp.begin(), tmp.end());
for(auto bit : tmp) mess.pb(bit);
}
int k = mess.size();
for(int i = 0; 2*i< k; i++)
{
int base = i<<1;
int m1 = base;
m1 = base | mess[2*i];
send(m1);
if(mess[2*i+1]) send(m1);
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define pb push_back
typedef pair<int, int> ii;
typedef long long ll;
int fuck[10000][2];
void decode(int N, int L, int X[])
{
memset(fuck, 0, sizeof fuck);
for(int i = 0; i< L; i++)
{
fuck[X[i]>>1][X[i]&1]++;
}
vector<int> res;
for(int i = 0; i< 4*N; i++)
{
if(fuck[i][0]>= 1)
{
res.pb(0);
if(fuck[i][0] == 2) res.pb(1);
else res.pb(0);
}
else
{
res.pb(1);
if(fuck[i][1] == 2) res.pb(1);
else res.pb(0);
}
}
for(int st = 0; st< 8*N; st += 8)
{
int run = 0;
for(int i = 0; i< 8; i++)
{
run *= 2;
run += res[st+i];
}
output(run);
}
}
# | 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... |