Submission #1030728

#TimeUsernameProblemLanguageResultExecution timeMemory
1030728coolboy19521Data Transfer (IOI19_transfer)C++17
0 / 100
5 ms2504 KiB
#include "transfer.h" #include "iostream" 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 ++) { int b = 0 < (xs & (1 << i)); v.push_back(b); } else for (int i = 0; i < 9; i ++) { int b = 0 < (xs & (1 << i)); v.push_back(b); } 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; //cout << xs << ' ' << axs << '\n'; for (int i = 1; i <= m; i ++) { if ((axs ^ i) == xs) { v.push_back(1 - data[i - 1]); axs = xs; } else v.push_back(data[i - 1]); } return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...