#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 |
1 |
Correct |
1 ms |
932 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1536 KB |
Output is correct |
2 |
Correct |
3 ms |
1536 KB |
Output is correct |
3 |
Correct |
3 ms |
1536 KB |
Output is correct |
4 |
Correct |
3 ms |
1536 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1536 KB |
Output is correct |
2 |
Correct |
3 ms |
1536 KB |
Output is correct |
3 |
Correct |
4 ms |
1536 KB |
Output is correct |
4 |
Correct |
3 ms |
1536 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1600 KB |
Output is correct |
2 |
Correct |
3 ms |
1536 KB |
Output is correct |
3 |
Correct |
3 ms |
1536 KB |
Output is correct |
4 |
Correct |
6 ms |
1792 KB |
Output is correct |
5 |
Correct |
6 ms |
1792 KB |
Output is correct |
6 |
Correct |
7 ms |
1792 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
3 ms |
1536 KB |
Output is partially correct - P = 6.000000 |
2 |
Partially correct |
6 ms |
1536 KB |
Output is partially correct - P = 6.000000 |
3 |
Incorrect |
0 ms |
1000 KB |
Error : Bad encoded integer |
4 |
Incorrect |
1 ms |
784 KB |
Error : Bad encoded integer |
5 |
Incorrect |
1 ms |
924 KB |
Error : Bad encoded integer |
6 |
Incorrect |
1 ms |
912 KB |
Error : Bad encoded integer |
7 |
Incorrect |
1 ms |
1004 KB |
Error : Bad encoded integer |