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"
using namespace std;
void encode(int N, int M[])
{
srand(879465);
vector <int> ord(N);
iota(ord.begin() ,ord.end() ,0);
random_shuffle(ord.begin() ,ord.end());
vector <int> m(N);
for(int i=0; i<N; i++)
m[i] = M[ord[i]]^(rand()%256);
vector <bool> bin(8*N ,0);
for(int i=0; i<N; i++)
for(int j=0; j<8; j++)
bin[8*i+j] = m[i]&(1<<j);
for(int i=0; i<bin.size(); i++)
if(bin[i]){
send(i & 255);
if(i >= 256)
send(i & 255);
}
}
#include "bits/stdc++.h"
#include "decoder.h"
#include "decoderlib.h"
using namespace std;
void decode(int N, int L, int X[])
{
srand(879465);
vector <int> ord(N) ,iord(N);
iota(ord.begin() ,ord.end() ,0);
random_shuffle(ord.begin() ,ord.end());
for(int i=0; i<N; i++)
iord[ord[i]] = i;
vector <bool> bin(8*N ,0);
for(int i=0; i<L; i++){
if(count(X ,X+L ,X[i]) == 3)
bin[256|X[i]] = 1 ,bin[X[i]] = 1;
else if(count(X ,X+L ,X[i]) == 2)
bin[256|X[i]] = 1;
else if(count(X ,X+L ,X[i]) == 1)
bin[X[i]] = 1;
}
vector <int> M(N);
for(int i=0; i<N; i++){
for(int j=0; j<8; j++)
M[i] |= (1<<j)*bin[8*i+j];
M[i] ^= rand()%256;
}
for(int i=0; i<N; i++)
output(M[iord[i]]);
}
Compilation message (stderr)
encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:21:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0; i<bin.size(); 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... |