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>
#include "encoder.h"
#include "encoderlib.h"
using namespace std;
void encode(int n , int m[]){
int cnt = 0;
for(int i = 0 ; i < n ; i += 1){
for(int j = 0 ; j < 8 ; j += 1){
if(j < 4){
if(m[i] & (1<<j)){
cnt += 1;
}
}else{
if(m[i] & (1<<j)){
cnt += 2;
}
}
}
}
if(cnt <= 6*n){
for(int i = 0 ; i < n ; i += 1){
int val = i*4;
for(int j = 0 ; j < 8 ; j += 1){
if(j < 4){
if(m[i]&(1<<j)){
send(val+j);
}
}else{
if(m[i]&(1<<j)){
send(val+j-4),send(val+j-4);
}
}
}
}
}else{
send(0),send(0),send(0),send(0);
for(int i = 0 ; i < n ; i += 1){
int val = i*4;
for(int j = 0 ; j < 8 ; j += 1){
if(j < 4){
if(m[i]&(1<<j)){
}else{
send(val+j);
}
}else{
if(m[i]&(1<<j)){
}else{
send(val+j-4),send(val+j-4);
}
}
}
}
}
}
#include <bits/stdc++.h>
#include "decoder.h"
#include "decoderlib.h"
using namespace std;
void decode(int n , int l , int X[]){
map<int,int> mp;
int ans[n];
for(int i = 0 ; i < l ; i += 1){
mp[X[i]] += 1;
}
for(int i = 0 ; i < n ; i += 1){
ans[i] = 0;
}
if(mp[0] >= 4){
mp[0] -= 4;
for(int i = 0 ; i < n ; i += 1){
ans[i] = (1<<8)-1;
}
}
for(auto i : mp){
int val = i.first%4 , val2 = i.first/4;
if(i.second == 1){
ans[val2] ^= (1<<val);
}else if(i.second == 2){
ans[val2] ^= (1<<(val+4));
}else if(i.second == 3){
ans[val2] ^= (1<<val);
ans[val2] ^= (1<<(val+4));
}
}
for(int i = 0 ; i < n ; i += 1){
output(ans[i]);
}
}
# | 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... |