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"
using namespace std;
void encode(int N, int M[])
{
int i;
for(i=0; i<N; i++)
{
send(i*8+M[i]/64);
for(int j = 0;j<2;j++)
{
send(i*8+M[i]/8-M[i]/64*8);
}
for(int j = 0;j<4;j++)
{
send(i*8+M[i]-M[i]/8*8);
}
}
}
#include "decoder.h"
#include "decoderlib.h"
#include <algorithm>
using namespace std;
void decode(int N, int L, int X[])
{
sort(X,X+L);
for (int i = 0;i<N;i++)
{
int answer = 0;
int countt = 0;
for(int j = 0;j<7;j++)
{
countt++;
if (i*7+j<L-1)
{
if (X[i*7+j] != X[i*7+j+1])
{
if (countt%2 ==1)
{
answer+=X[i*7+j]%8*64;
}
if (countt%4 == 2 or countt%4 == 3)
{
answer+=X[i*7+j]%8*8;
}
if (countt>=4)
{
answer+=X[i*7+j]%8;
}
countt = 0;
}
}
else
{
if (countt%2 ==1)
{
answer+=X[i*7+j]%8*64;
}
if (countt%4 == 2 or countt%4 == 3)
{
answer+=X[i*7+j]%8*8;
}
if (countt>=4)
{
answer+=X[i*7+j]%8;
}
countt = 0;
}
}
output(answer);
}
}
# | 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... |