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>
using namespace std;
//??????????????????????????
#ifndef _AAAAAAAAA
#include "encoder.h"
#include "encoderlib.h"
#else
void decode(int N, int L, int X[]);
void encode(int N, int M[]);
void output(int b);
void send(int a);
#endif
#pragma region dalykai
using p32 = pair<int, int>;
using p32u = pair<uint32_t, uint32_t>;
using p64 = pair<int64_t, int64_t>;
using p64u = pair<uint64_t, uint64_t>;
using vi16 = vector<int16_t>;
using vi16u = vector<uint16_t>;
using vi32 = vector<int>;
using vi32u = vector<uint32_t>;
using vi64 = vector<int64_t>;
using vi64u = vector<uint64_t>;
using vp32 = vector<p32>;
using vp32u = vector<p32u>;
using vp64 = vector<p64>;
using vp64u = vector<p64u>;
using vvi32 = vector<vi32>;
using vvi32u = vector<vi32u>;
using vvi64 = vector<vi64>;
using vvi64u = vector<vi64u>;
using vvp32 = vector<vp32>;
using vvp32u = vector<vp32u>;
using vvp64 = vector<vp64>;
using vvp64u = vector<vp64u>;
#pragma endregion
using _bit = bitset<512>;
// miau
const _bit noise("00100000110100000010100001000010010011000000000000000011111000000110000000000011010101101000001101101000110001000000001000001000000100000000010101000001000100101110001000101010010100000000000101010100001010001100000111000000001001100000101000000100000100000101000000010000000001100001010000011100001000010000100000001000010001010101001011000111101011111000110100100100101100000100111000001100010001001000100010000000000000100000000000101001110000010100001000000001000000010000000010101101000001010010011000011000");
void encode(int N, int M[])
{
_bit a;
for (int i = 0; i < N; i++)
{
a |= M[i];
if (i < N - 1)
{
a <<= 8;
}
}
for (int i = 0; i < min(512, 8 * N); i++)
{
a[i] = a[i] ^ noise[i];
}
for (int i = 0; i < 256; i++)
{
int count = a[i];
count |= (int)a[i + 256] << 1;
for (int j = 0; j < count; j++)
{
send(i);
}
}
}
#include <bits/stdc++.h>
using namespace std;
//??????????????????????????
#ifndef _AAAAAAAAA
#include "decoder.h"
#include "decoderlib.h"
#else
void decode(int N, int L, int X[]);
void encode(int N, int M[]);
void output(int b);
void send(int a);
#endif
#pragma region dalykai
using p32 = pair<int, int>;
using p32u = pair<uint32_t, uint32_t>;
using p64 = pair<int64_t, int64_t>;
using p64u = pair<uint64_t, uint64_t>;
using vi16 = vector<int16_t>;
using vi16u = vector<uint16_t>;
using vi32 = vector<int>;
using vi32u = vector<uint32_t>;
using vi64 = vector<int64_t>;
using vi64u = vector<uint64_t>;
using vp32 = vector<p32>;
using vp32u = vector<p32u>;
using vp64 = vector<p64>;
using vp64u = vector<p64u>;
using vvi32 = vector<vi32>;
using vvi32u = vector<vi32u>;
using vvi64 = vector<vi64>;
using vvi64u = vector<vi64u>;
using vvp32 = vector<vp32>;
using vvp32u = vector<vp32u>;
using vvp64 = vector<vp64>;
using vvp64u = vector<vp64u>;
#pragma endregion
using _bit = bitset<512>;
// uaim
const _bit noise("00100000110100000010100001000010010011000000000000000011111000000110000000000011010101101000001101101000110001000000001000001000000100000000010101000001000100101110001000101010010100000000000101010100001010001100000111000000001001100000101000000100000100000101000000010000000001100001010000011100001000010000100000001000010001010101001011000111101011111000110100100100101100000100111000001100010001001000100010000000000000100000000000101001110000010100001000000001000000010000000010101101000001010010011000011000");
void decode(int N, int L, int X[])
{
_bit a;
vi16 count(256);
for (int i = 0; i < L; i++)
{
count[X[i]]++;
}
for (int i = 0; i < 256; i++)
{
a[i] = bool(count[i] & 1) ^ noise[i];
a[i + 256] = bool(count[i] & 2) ^ noise[i + 256];
}
vi32 things_a;
for (int i = 0; i < N; i++)
{
int val = 0;
for (int j = 0; j < 8; j++)
{
val |= a[j] << j;
}
things_a.push_back(val);
a >>= 8;
}
for (int i = (int)things_a.size() - 1; i >= 0; i--)
{
output(things_a[i]);
}
}
Compilation message (stderr)
encoder.cpp:14: warning: ignoring '#pragma region dalykai' [-Wunknown-pragmas]
14 | #pragma region dalykai
|
encoder.cpp:37: warning: ignoring '#pragma endregion ' [-Wunknown-pragmas]
37 | #pragma endregion
|
decoder.cpp:14: warning: ignoring '#pragma region dalykai' [-Wunknown-pragmas]
14 | #pragma region dalykai
|
decoder.cpp:37: warning: ignoring '#pragma endregion ' [-Wunknown-pragmas]
37 | #pragma endregion
|
# | 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... |