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;
vector<vector<int>> gr;
void bt(vector<int> &x){
gr.push_back(x);
if(x.size() == 7) return;
int last = 0;
if (x.size()!=0) last=x.back();
for(int i = last; i <=3; i++){
x.push_back(i);
bt(x);
x.pop_back();
}
}
void encode(int N, int M[])
{
{vector<int> x; bt(x);}
cerr << gr.size();
int i;
for(i=0; i<N; i++){
auto x = gr[M[i]];
for(auto j:x){
send((i<<2) | j);
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <vector>
#include<algorithm>
using namespace std;
vector<vector<int>> gr;
void bt(vector<int> &x){
gr.push_back(x);
if(x.size() == 7) return;
int last = 0;
if (x.size()!=0) last=x.back();
for(int i = last; i <=3; i++){
x.push_back(i);
bt(x);
x.pop_back();
}
}
void decode(int N, int L, int X[])
{
{vector<int> x; bt(x);}
int i, b;
vector<int> O[128];
for(i=0; i<L; i++) {
b = X[i];
O[b>>2].push_back(b&3);
}
for(i = 0; i < N; i++){
int it = int(lower_bound(gr.begin(), gr.end(), O[i])-gr.begin());
output(it);
}
}
# | 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... |