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;
string con(int x)
{
string ret;
while(x){
ret+=(x%2)+'0';
x/=2;
}
while(ret.size()<8)ret+='0';
return ret;
}
void encode(int N, int M[])
{
int cnt=-1;
for(int j=0;j<N;j++){
int x=M[j];
string s=con(x);
for(int i=1;i<=4;i++){
cnt++;
int v=cnt;
char u=s.back();
s.pop_back();
int x=u-'0';
u=s.back();
s.pop_back();
int y=u-'0';
if(j==N-1&&i==4){
}
x*=2;
x+=y;
v=x+v*4;
send(v);
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <bits/stdc++.h>
using namespace std;
void decode(int N, int L, int X[])
{
sort(X,X+L);
int add=0;
int mx=0;
for(int i=0;i<L;i++){
mx=max(mx,X[i]);
int u=X[i];
if(i%4==0&&i!=0){
output(add);
add=0;
}
u%=4;
add*=4;
add+=u;
}
// cout<<mx<<endl;
output(add);
}
# | 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... |