Submission #1035587

#TimeUsernameProblemLanguageResultExecution timeMemory
1035587NeroZeinParrots (IOI11_parrots)C++17
88 / 100
8 ms1508 KiB
#include "encoder.h" #include "encoderlib.h" #include <bits/stdc++.h> using namespace std; void encode(int N, int M[]) { 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; 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}]++; } vector<int> ans(N); for (auto [p, cnt] : mp) { int ind = p.first, bind = p.second; if (cnt & 2) { ans[ind + 32] |= 1 << bind; //cerr << "ind, bind: " << ind + 32 << ' ' << bind << '\n'; } 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...