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<bits/stdc++.h>
#include "encoder.h"
#include "encoderlib.h"
using namespace std;
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<bits/stdc++.h>
#include "decoder.h"
#include "decoderlib.h"
using namespace std;
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]);
}
}
# | 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... |