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"
void encode(int N, int M[])
{
int ans = 0;
for(int i=0; i<N; ++i)
for(int j=7; j>=0; --j)
{
if(M[i]&(1<<j)) ++ans;
if(ans != 256) send(ans);
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <vector>
#include <algorithm>
#include <cstdio>
void decode(int N, int L, int X[])
{
std::vector<int> p(X, X+L);
while((int)p.size() <= 8*N) p.push_back(256);
p.push_back(0);
std::sort(p.begin(), p.end());
int ans = 0;
for(int i=0; i<8*N; ++i)
{
ans = 2 * ans + (p[i+1] - p[i]);
if((i&7) == 7)
{
output(ans);
ans = 0;
}
}
}
# | 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... |