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 <bits/stdc++.h>
#define f first
#define s second
#define ent '\n';
using namespace std;
typedef long long ll;
const int mx=2e5+12;
void output(int b);
void send(int a);
vector<int> g[mx];
int cnt[mx];
int p[mx];
void encode(int n, int a[]){
int last=0;
vector<int> x,y;
for(int i=0;i<n;i++){
for(int j=0;j<8;j+=2){
if((a[i]&(1<<j))){
x.push_back(last);
}
else y.push_back(last);
if((a[i]&(1<<(j+1)))){
x.push_back(last);
x.push_back(last);
}
else{
y.push_back(last);
y.push_back(last);
}
last++;
}
}
y.push_back(0);
y.push_back(0);
y.push_back(0);
y.push_back(0);
if(x.size()>y.size()){
x.swap(y);
}
for(int d:x){
send(d);
}
}
#include <bits/stdc++.h>
#define f first
#define s second
#define ent '\n';
using namespace std;
typedef long long ll;
const int mx=2e5+12;
void output(int b);
void send(int a);
vector<int> g[mx];
int cnt[mx];
int p[mx];
void decode(int m, int n, int a[]){
sort(a,a+n);
for(int i=0;i<256;i++){
cnt[i]=0;
g[i].clear();
}
for(int i=0;i<n;i++){
cnt[a[i]]++;
}
bool ok=0;
if(cnt[0]>=4){
ok=1;
cnt[0]-=4;
}
for(int i=0;i<256;i++){
if(ok)cnt[i]=3-cnt[i];
}
int last=0;
for(int i=0;i<m;i++){
int x=0;
for(int j=0;j<8;j+=2){
while(cnt[last]--){
x+=(1<<j);
}
last++;
}
output(x);
}
}
# | 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... |