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;
void encode(int N, int M[]){
if(N > 32){
mt19937 mt(7);
auto rnd = [&](int mod){
return mt() % mod;
};
int p[64];
for(int i = 0; i < N; ++i)
p[i] = i;
random_shuffle(p, p + N, rnd);
for(int i = 0; i < N; ++i){
for(int j = 0; j <= 7; ++j){
if(M[p[i]] & (1 << j)){
if(i >= 32){
send((i - 32) * 8 + j);
send((i - 32) * 8 + j);
}
else send(i * 8 + j);
}
}
}
return;
}
for(int i = 0; i < N; ++i){
for(int j = 0; j <= 7; ++j){
if(M[i] & (1 << j))
send(i * 8 + j);
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
static int e[256];
void decode(int N, int L, int X[]){
for(int i = 0; i < 256; ++i)
e[i] = 0;
if(N > 32){
for(int i = 0; i < L; ++i)
e[X[i]]++;
mt19937 mt(7);
auto rnd = [&](int mod){
return mt() % mod;
};
int p[64];
for(int i = 0; i < N; ++i)
p[i] = i;
random_shuffle(p, p + N, rnd);
int ans[64];
for(int i = 0; i < N; ++i){
int curr = 0;
for(int j = 0; j <= 7; ++j){
if(i >= 32){
if(e[(i - 32) * 8 + j] & 2)
curr += (1 << j);
}
else{
if(e[i * 8 + j] & 1)
curr += (1 << j);
}
}
ans[p[i]] = curr;
}
for(int i = 0; i < N; ++i)
output(ans[i]);
return;
}
for(int i = 0; i < L; ++i)
e[X[i]] = true;
for(int i = 0; i < N; ++i){
int curr = 0;
for(int j = 0; j <= 7; ++j){
if(e[i * 8 + j])
curr += (1 << j);
}
output(curr);
}
}
# | 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... |