Submission #1175764

#TimeUsernameProblemLanguageResultExecution timeMemory
1175764mannshah1211Data Transfer (IOI19_transfer)C++20
60 / 100
5 ms1724 KiB
#include "transfer.h" #include <bits/stdc++.h> using namespace std; vector<int> get_attachment(vector<int> source) { int xo = 0, cnt = 0; for (int i = 0; i < source.size(); i++) { if (source[i] == 0) { xo ^= (i + 1); cnt++; } } vector<int> attachment; for (int i = 5; i >= 0; i--) { if (xo & (1 << i)) { attachment.push_back(1); } else { attachment.push_back(0); } } attachment.push_back(cnt % 2); return attachment; } vector<int> retrieve(vector<int> data) { int xo = 0, cnt = 0; for (int i = 0; i < data.size() - 7; i++) { if (data[i] == 0) { xo ^= (i + 1); cnt++; } } vector<int> ans; for (int i = 0; i < data.size() - 7; i++) { ans.push_back(data[i]); } int reported_parity = data[data.size() - 1], reported_xo = 0; for (int i = data.size() - 7; i < data.size() - 1; i++) { reported_xo = (2 * reported_xo) + data[i]; } if (xo == reported_xo || cnt % 2 == reported_parity) { return ans; } ans[(xo ^ reported_xo) - 1] = 1 - ans[(xo ^ reported_xo) - 1]; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...