Submission #1030716

#TimeUsernameProblemLanguageResultExecution timeMemory
1030716coolboy19521Data Transfer (IOI19_transfer)C++17
0 / 100
2 ms1040 KiB
#include "transfer.h" using namespace std; vector<int> get_attachment(vector<int> source) { int n = source.size(); int xs = 0; for (int i = 1; i <= n; i ++) xs ^= source[i - 1] * i; vector<int> v; if (63 == n) for (int i = 0; i < 7; i ++) v.push_back(xs & (1 << i)); else for (int i = 0; i < 9; i ++) v.push_back(xs & (1 << i)); return v; } vector<int> retrieve(vector<int> data) { vector<int> v; int m = data.size(); int xs = 0; if (70 == m) { for (int i = 63; i < 70; i ++) xs |= data[i] * (1 << (i - 63)); m -= 7; } else { for (int i = 255; i < 264; i ++) xs |= data[i] * (1 << (i - 255)); m -= 9; } int axs = 0; for (int i = 1; i <= m; i ++) axs ^= data[i - 1] * i; for (int i = 1; i <= m; i ++) { int b = 1 - data[i - 1]; if ((axs ^ (b * i)) == xs) { v.push_back(b); axs = xs; } else v.push_back(1 - b); } return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...