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"
#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define sz(x) int((x).size())
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> ii;
template<class X, class Y>
inline bool maximize(X &x, const Y &y) {return (x < y ? x = y, 1 : 0);}
template<class X, class Y>
inline bool minimize(X &x, const Y &y) {return (x > y ? x = y, 1 : 0);}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int Random(int l, int r) {
return uniform_int_distribution<int>(l, r)(rng);
}
//#define Nhoksocqt1
#ifdef Nhoksocqt1
vector<int> encoder, token;
void send(int a) {
assert(a >= 0 && a <= 65535);
encoder.push_back(a);
}
void output(int b) {
token.push_back(b);
}
#endif // Nhoksocqt1
void encode(int N, int M[]) {
for (int i = 0; i < N; ++i)
send((M[i] << 4) ^ i);
}
#ifdef Nhoksocqt1
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
freopen("PARROTS.inp", "r", stdin);
freopen("PARROTS.out", "w", stdout);
encoder.clear(), token.clear();
int m[70], L[500], n;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> m[i];
m[i] = Random(0, 255); cout << m[i] << " \n"[i + 1 == n];
}
encode(n, m);
cout << "NUMBER BIRD: " << sz(encoder) << '\n';
for (int it = 0; it < sz(encoder); ++it)
L[it] = encoder[it];
decode(n, sz(encoder), L);
cout << "TOKEN GET: " << sz(token) << '\n';
assert(sz(token) == n);
for (int it = 0; it < n; ++it)
assert(token[it] == m[it]);
return 0;
}
#endif // Nhoksocqt1
#include "decoder.h"
#include "decoderlib.h"
#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define sz(x) int((x).size())
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> ii;
template<class X, class Y>
inline bool maximize(X &x, const Y &y) {return (x < y ? x = y, 1 : 0);}
template<class X, class Y>
inline bool minimize(X &x, const Y &y) {return (x > y ? x = y, 1 : 0);}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int Random(int l, int r) {
return uniform_int_distribution<int>(l, r)(rng);
}
//#define Nhoksocqt1
#ifdef Nhoksocqt1
vector<int> encoder, token;
void send(int a) {
assert(a >= 0 && a <= 65535);
encoder.push_back(a);
}
void output(int b) {
token.push_back(b);
}
#endif // Nhoksocqt1
void decode(int N, int L, int X[]) {
for (int i = 0; i < N; ++i) {
for (int j = 0; j < L; ++j) {
if((X[i] & ((1 << 4) - 1)) == j) {
output(X[i] >> 4);
break;
}
}
}
}
#ifdef Nhoksocqt1
int main() {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
freopen("PARROTS.inp", "r", stdin);
freopen("PARROTS.out", "w", stdout);
encoder.clear(), token.clear();
int m[70], L[500], n;
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> m[i];
m[i] = Random(0, 255); cout << m[i] << " \n"[i + 1 == n];
}
encode(n, m);
cout << "NUMBER BIRD: " << sz(encoder) << '\n';
for (int it = 0; it < sz(encoder); ++it)
L[it] = encoder[it];
decode(n, sz(encoder), L);
cout << "TOKEN GET: " << sz(token) << '\n';
assert(sz(token) == n);
for (int it = 0; it < n; ++it)
assert(token[it] == m[it]);
return 0;
}
#endif // Nhoksocqt1
Compilation message (stderr)
encoder.cpp:8: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
8 | #pragma GCC optimization ("O3")
|
encoder.cpp:9: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
9 | #pragma GCC optimization ("unroll-loops")
|
decoder.cpp:8: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
8 | #pragma GCC optimization ("O3")
|
decoder.cpp:9: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
9 | #pragma GCC optimization ("unroll-loops")
|
# | 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... |