# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
934515 | tmarcinkevicius | Parrots (IOI11_parrots) | C++14 | 0 ms | 0 KiB |
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[])
{
for (int i = 0; i < N; i++)
{
bitset<16> number(M[i]);
bitset<8> position(i);
for (int i = 0; i < 8; i++)
{
number[8 + i] = position[i];
}
send((int)number.to_ulong());
}
}
#include "decoder.h"
#include "decoderlib.h"
void decode(int N, int L, int X[])
{
vector<int> ans(N);
for (int i = 0; i < L; i++)
{
bitset<16> number(X[i]);
bitset<8> num, pos;
for (int i = 0; i < 8; i++)
{
pos[i] = number[8 + i];
num[i] = number[i];
}
int position = (int)pos.to_ullong();
int theNum = (int)num.to_ullong();
ans[position] = theNum;
}
for (int i = 0; i < L; i++)
{
output(ans[i]);
}
}