Submission #1048333

#TimeUsernameProblemLanguageResultExecution timeMemory
1048333TahirAliyevData Transfer (IOI19_transfer)C++17
80 / 100
60 ms2940 KiB
#include "transfer.h" #include <bits/stdc++.h> using namespace std; vector<int> get_attachment(vector<int> source) { int x = 0; int n = source.size(); for(int i = 1; i <= n; i++){ if(source[i - 1]) x ^= i; } vector<int> v; int l = 0; if(n == 63) l = 6; else l = 8; for(int i = 0; i < l; i++){ v.push_back(bool(x & (1 << i))); } for(int i = 0; i < l; i++){ v.push_back(bool(x & (1 << i))); } return v; } vector<int> retrieve(vector<int> data) { int n, l; if(data.size() == 63 + 6 + 6) n = 63, l = 6; else n = 255, l = 8; int x = 0; for(int i = 1; i <= n; i++){ if(data[i - 1]) x ^= i; } int x1 = 0, x2 = 0; for(int i = 0; i < l; i++){ if(data[n + i]){ x1 |= (1 << i); } } for(int i = 0; i < l; i++){ if(data[n + l + i]){ x2 |= (1 << i); } } if(x1 == x2){ if(x != x1) data[(x ^ x1) - 1] ^= 1; } vector<int> v; for(int i = 0; i < n; i++) v.push_back(data[i]); return v; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...