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"
#define n nnnnnnn1
#define a aaaaaaa1
#define c ccccccc1
#define sum sumsumsum
typedef int ll;
ll n;
ll a[105];
ll sum = 0;
ll c[265];
void encode(int N, int M[])
{
n = N;
for(ll i = 0; i < n; i++)
{
a[i] = M[i];
}
sum = 0;
for(ll i = 0; i < 256; i++)
{
c[i] = 0;
}
for(ll i = 0; i < n; i++)
{
ll b[4] = {a[i] % 4, a[i] / 4 % 4, a[i] / 16 % 4, a[i] / 64 % 4};
for(ll j = 0; j < 4; j++)
{
c[i * 4 + j] = b[j];
sum += c[i * 4 + j];
}
}
if(sum > n * 6)
{
for(ll i = 0; i < 4 * n; i++)
{
c[i] = 3 - c[i];
}
send(0);send(0);send(0);send(0);
}
for(ll i = 0; i < 256; i++)
{
for(ll j = 0; j < c[i]; j++)
{
send(i);
}
}
}
#include "decoder.h"
#include "decoderlib.h"
typedef int ll;
ll n;
ll m;
ll a[10005];
ll b[265];
bool v = false;
void decode(int N, int L, int X[])
{
n = N;
m = L;
v = false;
for(ll i = 0; i < 4 * n; i++) b[i] = 0;
for(ll i = 0; i < m; i++)
{
a[i] = X[i];
b[a[i]]++;
}
if(b[0] >= 4)
{
b[0] -= 4, v = true;
}
for(ll i = 0; i < 4 * n; i++)
{
if(v) b[i] = 3 - b[i];
}
for(ll i = 0; i < n; i++)
{
ll t1 = b[i * 4 + 0] * 1;
ll t2 = b[i * 4 + 1] * 4;
ll t3 = b[i * 4 + 2] * 16;
ll t4 = b[i * 4 + 3] * 64;
output(t1 + t2 + t3 + t4);
}
}
# | 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... |