이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "encoder.h"
#include "encoderlib.h"
//#include "grader.cpp"
//#include"decoder.cpp"
#include<bits/stdc++.h>
using namespace std;
namespace{
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[])
{
gr.clear();
{vector<int> x; bt(x);}
sort(gr.begin(), gr.end());
//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>
#include<iostream>
using namespace std;
namespace{
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[])
{
gr.clear();
{vector<int> x; bt(x);}
sort(gr.begin(), gr.end());
int i, b;
vector<int> O[128];
for(i=0; i<L; i++) {
b = X[i];
O[b>>2].push_back(b&3);
//cerr << (b>>2) << ' ';
}
cerr << '\n';
for(i = 0; i < N; i++){
sort(O[i].begin(), O[i].end());
int it = int(lower_bound(gr.begin(), gr.end(), O[i])-gr.begin());
cerr << it << '\n';
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... |