제출 #1035614

#제출 시각아이디문제언어결과실행 시간메모리
1035614NeroZein앵무새 (IOI11_parrots)C++17
98 / 100
10 ms1400 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; void encode(int N, int M[]) { int ones = 0, zeros = 0; for (int i = 0; i < N; ++i) { for (int j = 0; j < 8; ++j) { if (M[i] >> j & 1) { ones++; } else { zeros++; } } } if (ones <= zeros) { for (int i = 0; i < N; ++i) { for (int j = 0; j < 8; ++j) { int num = i; if (i >= 32) { num -= 32; } if (M[i] >> j & 1) { //cerr << "S: " << (num | (j << 5)) << '\n'; send(num | (j << 5)); if (i >= 32) { send(num | (j << 5)); } } } } } else { send(0); send(0); send(0); send(0); for (int i = 0; i < N; ++i) { for (int j = 0; j < 8; ++j) { int num = i; if (i >= 32) { num -= 32; } if (!(M[i] >> j & 1)) { send(num | (j << 5)); if (i >= 32) { send(num | (j << 5)); } } } } } }
#include "decoder.h" #include "decoderlib.h" #include <bits/stdc++.h> using namespace std; void decode(int N, int L, int X[]) { map<pair<int, int>, int> mp; vector<int> ans(N); if (count(X, X + L, 0) >= 4) { fill(ans.begin(), ans.end(), 255); } for (int i = 0; i < L; ++i) { int ind = 0; for (int j = 0; j < 5; ++j) { ind |= ((X[i] & 1) << j); X[i] >>= 1; } int bind = X[i]; mp[{ind, bind}]++; } for (auto [p, cnt] : mp) { int ind = p.first, bind = p.second; if (cnt & 2) { ans[ind + 32] ^= 1 << bind; } if (cnt & 1) { ans[ind] ^= 1 << bind; } } for (int i = 0; i < N; ++i) { output(ans[i]); } }
#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...