Submission #789671

#TimeUsernameProblemLanguageResultExecution timeMemory
789671radaiosm7Data Transfer (IOI19_transfer)C++17
100 / 100
45 ms2496 KiB
#include "transfer.h" #include <bits/stdc++.h> using namespace std; int n, k, i, j, c[3]; vector<int> att; vector<int> get_attachment(vector<int> source) { att.clear(); n = (int)source.size(); c[0] = 0; c[2] = 0; k = (n == 63) ? 6 : 8; for (i=1; i <= n; ++i) if (source[i-1] == 0) c[0] ^= i; for (i=0; i < k; ++i) (c[0] & (1 << i)) ? (att.push_back(1)) : (att.push_back(0)); for (i=0; i < k; ++i) c[2] ^= att[i]; att.push_back(c[2]); return att; } vector<int> retrieve(vector<int> data) { n = (int)data.size(); k = (n == 70) ? 6 : 8; n -= k+1; c[0] = 0; c[1] = 0; c[2] = 0; for (i=1; i <= n; ++i) if (data[i-1] == 0) c[0] ^= i; for (j=0; j < k; ++j) if (data[n+j] == 1) c[1] += (1 << j); for (j=0; j < k; ++j) c[2] ^= data[n+j]; if (c[0] != c[1] && c[2] == data[n+k]) data[(c[0]^c[1])-1] ^= 1; data.resize(n); return data; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...