Submission #1127184

#TimeUsernameProblemLanguageResultExecution timeMemory
1127184julia_08Data Transfer (IOI19_transfer)C++20
0 / 100
6 ms1724 KiB
#include "transfer.h" #include <bits/stdc++.h> using namespace std; vector<int> get_attachment(vector<int> source){ int l = 9; if(source.size() == 63) l = 7; vector<int> ans; int xor_sum = 0, x = 0; for(int i=0; i<(int) source.size(); i++){ if(source[i] == 1){ xor_sum ^= (i + 1); x ^= 1; } } ans.push_back(x); for(int i=0; i<l-1; i++){ if(xor_sum & (1 << i)){ ans.push_back(1); } else ans.push_back(0); } return ans; } vector<int> retrieve(vector<int> data){ int l = 9; if(data.size() == 70) l = 7; vector<int> ans; int xor_sum = 0, x = 0; for(int i=data.size()-(l-1); i<data.size(); i++){ if(data[i] == 1){ xor_sum += (1 << (i - data.size() + (l - 1))); x ^= 1; } } int xor_one = 0; for(int i=0; i<data.size()-l; i++){ if(data[i] == 1){ xor_one ^= (i + 1); } } if(x != data[data.size() - l]){ for(int i=0; i<data.size()-l; i++){ ans.push_back(data[i]); } } else{ for(int i=0; i<data.size()-l; i++){ if((xor_one ^ xor_sum) == (i + 1)){ ans.push_back(1 - data[i]); } else ans.push_back(data[i]); } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...