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[])
{
for(int i=0;i<N;i++){
int temp=M[i],ct=0;
while(temp>0){
int x=i+(1<<4)*ct+(1<<7)*(temp%2);
//printf("%i %i %i: %i\n",i,ct,temp%2,x);
send(x);
ct++;
temp/=2;
}
}
/*for(int i=0,sum=0;i<N;i++){
sum+=M[i];
send(sum);
}*/
/*int i;
for(i=0; i<N; i++)
send(M[i]);*/
}
#include<bits/stdc++.h>
#include "decoder.h"
#include "decoderlib.h"
using namespace std;
#define pb push_back
void decode(int N, int L, int X[])
{
int res[N+10]={0};
for(int i=0;i<L;i++){
int temp=X[i],ct=8;
vector<int>bits;
while(ct--){
bits.pb(temp%2);
temp/=2;
}
int ind=X[i]%(1<<4);
/*for(int j=0;j<4;j++){
ind+=(1<<j)*bits[4-j];
}*/
int idx=(X[i]/(1<<4))%(1<<3);
/*for(int j=4;j<=6;j++){
idx+=(1<<(j-4))*(bits[4+6-j]);
}*/
res[ind]+=(1<<idx)*bits.back();
}
for(int i=0;i<N;i++){
output(res[i]);
//printf("%i ",res[i]);
}
//printf("\n");
/*sort(X,X+L);
output(X[0]);
for(int i=1;i<L;i++){
output(X[i]-X[i-1]);
}*/
/*int i, b;
for(i=0; i<L; i++) {
b = X[i];
output(b);
}*/
}
# | 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... |