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;
///Subtask 4
///Represent the numbers as a binary string and send positions of 1's
void encode(int N, int M[])
{
int idx=0;
for(int i=0;i<N;i++){
for(int bit=0;bit<8;bit++){
if(M[i]&(1<<bit))
send(idx+bit);
}
idx+=8;
}
}
#include "decoder.h"
#include "decoderlib.h"
#include<bits/stdc++.h>
using namespace std;
///Subtask 4
///Represent the numbers as a binary string and send positions of 1's
void decode(int N, int L, int X[])
{
vector<int> binary(8*N,0);
sort(X,X+L);
for(int i=0;i<L;i++){
binary[X[i]]=1;
}
for(int i=0;i<8*N;i+=8){
int number=0;
for(int bit=0;bit<8;bit++){
if(binary[i+bit]) number+=(1<<bit);
}
output(number);
}
}
# | 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... |