Submission #1006211

#TimeUsernameProblemLanguageResultExecution timeMemory
1006211basaData Transfer (IOI19_transfer)C++14
0 / 100
6 ms4628 KiB
#include <bits/stdc++.h> // #include "transfer.h" using namespace std; vector<int>get_attachment(vector<int>a) { int eo = 0; int one = 0; int n = a.size(); vector<int>ret; for(int i = 0; i < n; i++){ eo ^= a[i]; if(a[i] == 1) one ^= i + 1; ret.push_back(a[i]); } for(int i = 7; i >= 0; i--){ int bit = 1 << i; if(one >= bit){ one -= bit; ret.push_back(1); } else ret.push_back(0); } ret.push_back(eo); return ret; } vector<int> retrieve(vector<int> data) { int n = data.size(); int back = 0; for(int i = n - 9, j = 7; i < n - 1; i++, j--){ if(data[i]) back += 1 << j; } int eo = 0; vector<int>ret; for(int i = 0; i < n - 9; i++){ ret.push_back(data[i]); eo ^= data[i]; } if(eo == data.back()) return ret; int p = 0; for(int i = 0; i < n - 9; i++){ if(data[i]) p ^= i + 1; } if((p ^ back) > 0) ret[(p ^ back) - 1] = !ret[(p ^ back) - 1]; cout << (p ^ back); return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...