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;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
static map<int,vector<int> > m={
{0,{0,0,0}},
{1,{0,0,1}},
{2,{0,0,2}},
{3,{0,0,3}},
{4,{0,1,1}},
{5,{0,1,2}},
{6,{0,1,3}},
{7,{0,2,2}},
{8,{0,2,3}},
{9,{0,3,3}},
{10,{1,1,1}},
{11,{1,1,2}},
{12,{1,1,3}},
{13,{1,2,2}},
{14,{1,2,3}},
{15,{1,3,3}},
{16,{2,2,2}}
};
void encode(int n, int arr[]){
vector<int> bits;
rep(x,0,n){
int curr=arr[x];
rep(y,0,8){
bits.push_back(curr&1);
curr>>=1;
}
}
rep(x,0,n*2){
int curr=0;
rep(y,0,4) curr|=bits[x*4+y]<<y;
auto temp=m[curr];
for (auto &it:temp){
send(x<<2|it);
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define fi first
#define se second
#define endl '\n'
#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
static map<vector<int>,int > m={
{{0,0,0},0},
{{0,0,1},1},
{{0,0,2},2},
{{0,0,3},3},
{{0,1,1},4},
{{0,1,2},5},
{{0,1,3},6},
{{0,2,2},7},
{{0,2,3},8},
{{0,3,3},9},
{{1,1,1},10},
{{1,1,2},11},
{{1,1,3},12},
{{1,2,2},13},
{{1,2,3},14},
{{1,3,3},15},
{{2,2,2},16}
};
vector<int> v[64];
void decode(int n, int l, int arr[]){
rep(x,0,64) v[x].clear();
vector<int> bits(l);
rep(x,0,l){
v[arr[x]>>2].push_back(arr[x]&3);
}
rep(x,0,64) sort(all(v[x]));
rep(x,0,n){
output(m[v[x*2]]|m[v[x*2+1]]<<4);
}
}
# | 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... |