제출 #707649

#제출 시각아이디문제언어결과실행 시간메모리
707649Nhoksocqt1앵무새 (IOI11_parrots)C++17
52 / 100
3 ms1048 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...