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>
#include "encoder.h"
#include "encoderlib.h"
#define pb push_back
using namespace std;
void encode(int N, int M[])
{
vector<int> mesAct, mesInact={0, 0, 0, 0};
for(int i=0;i<N;i++){
for(int j=0;j<8;j++){
int pos=i, id=j>>1;
//cout << pos << " " << id << "\n";
if(!(M[i]&(1<<j))){
if(j&1) mesInact.pb(pos+(id<<6));
mesInact.pb(pos+(id<<6));
}
else{
if(j&1) mesAct.pb(pos+(id<<6));
mesAct.pb(pos+(id<<6));
}
}
}
//cout << (int)mesAct.size() << " X " << (int)mesInact.size() << "\n";
if((int)mesAct.size()<(int)mesInact.size()){
for(auto u : mesAct) send(u);
}
else{
for(auto u : mesInact) send(u);
}
}
#include <bits/stdc++.h>
#include "decoder.h"
#include "decoderlib.h"
#define all(x) x.begin(), x.end()
using namespace std;
void decode(int N, int L, int X[])
{
vector<int> arr;
vector<int> ent(L);
for(int i=0;i<L;i++) ent[i]=X[i];
sort(all(ent));
bool flag=0;
int id=0;
if(L>=4 && ent[3]==0) arr.assign(N, 255), id=4, flag=1;
else arr.assign(N, 0);
//for(int i=0;i<N;i++) cout << arr[i] << " \n"[i==N-1];
for(;id<L;id++){
int u=ent[id];
int p=u%(1<<6), val=(u/(1<<6))<<1;
//cout << u << "\t" << p << "\t" << val << "\n";
if(flag) arr[p]-=(1<<val);
else arr[p]+=(1<<val);
}
//for(int i=0;i<N;i++) cout << arr[i] << " \n"[i==N-1];
for(int i=0;i<N;i++) output(arr[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... |