이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 <= 255);
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) {
for (int j = 0; j < 4; ++j) {
int pos = (4 * i + j), val = ((M[i] >> (2 * j)) & 3);
send((pos << 2) ^ val);
}
}
}
#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];
shuffle(L, L + sz(encoder), rng);
decode(n, sz(encoder), L);
cout << "TOKEN GET: " << sz(token) << '\n';
assert(sz(token) == n);
for (int it = 0; it < n; ++it)
cout << token[it] << " \n"[it + 1 == 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 <= 255);
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) {
int val(0);
for (int j = 0; j < L; ++j) {
if((X[j] >> 2) >= 4 * i && (X[j] >> 2) < 4 * (i + 1)) {
//cout << i << ' ' << j << ' ' << ((X[j] >> 2) & 3) << '\n';
val ^= ((X[j] & 3) << (2 * ((X[j] >> 2) & 3)));
}
}
output(val);
}
}
#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];
shuffle(L, L + sz(encoder), rng);
decode(n, sz(encoder), L);
cout << "TOKEN GET: " << sz(token) << '\n';
assert(sz(token) == n);
for (int it = 0; it < n; ++it)
cout << token[it] << " \n"[it + 1 == n];
//for (int it = 0; it < n; ++it)
// assert(token[it] == m[it]);
return 0;
}
#endif // Nhoksocqt1
컴파일 시 표준 에러 (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... |