Submission #208636

#TimeUsernameProblemLanguageResultExecution timeMemory
208636eriksuenderhaufData Transfer (IOI19_transfer)C++14
100 / 100
279 ms2664 KiB
#include <bits/stdc++.h> #include "transfer.h" #define vi vector<int> #define pb push_back using namespace std; vi get_attachment(vi source) { int n = source.size(); vi ret; int xo = 0; for (int i = 0; i < n; i++) xo ^= source[i]; ret.pb(xo); for (int i = 0; (1 << i) < n; i++) { xo = 0; for (int j = 0; j < n; j++) if ((j+1) & (1 << i)) xo ^= source[j]; ret.pb(xo); } return ret; } vi retrieve(vi data) { int n = data.size() < 255 ? 63 : 255; vi ret; int xo = 0; for (int i = 0; i < n; i++) xo ^= data[i]; ret.pb(xo); for (int i = 0; (1 << i) < n; i++) { xo = 0; for (int j = 0; j < n; j++) if ((j+1) & (1 << i)) xo ^= data[j]; ret.pb(xo); } int k = data.size() - n; if (ret[0] == data[n]) return vi(data.begin(), data.end() - k); int idx = 0; for (int i = 1; i < k; i++) if (ret[i] != data[n + i]) idx |= (1 << (i-1)); if (idx) data[idx-1] ^= 1; return vi(data.begin(), data.end() - k); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...