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(465);
for(int i=0; i<N; i++)
M[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(465);
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;
}
for(int i=0; i<N; i++){
int num = 0;
for(int j=0; j<8; j++)
num |= (1<<j)*bin[8*i+j];
output(num ^ (rand()%256));
}
}
Compilation message (stderr)
encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:17: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... |