Submission #980692

#TimeUsernameProblemLanguageResultExecution timeMemory
980692penguin133Data Transfer (IOI19_transfer)C++17
0 / 100
9 ms2516 KiB
#include <bits/stdc++.h> using namespace std; #include "transfer.h" //#define int long long #define pi pair<int, int> #define pii pair<int, pi> #define fi first #define se second #ifdef _WIN32 #define getchar_unlocked _getchar_nolock #endif mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); std::vector<int> get_attachment(std::vector<int> source) { int n = (int)source.size(); vector <int> ans; for(int i = 0; (1 << i) < n; i++){ int x = 0; for(int j = 0; j < n; j++)if(j >> i & 1)x ^= source[j]; ans.push_back(x); } int x = 0; for(int i = 0; i < n; i++)x ^= source[i]; ans.push_back(x); return ans; } std::vector<int> retrieve(std::vector<int> data) { int n, num; if((int)data.size() >= 200)n = 255, num = 9; else n = 63, num = 7; int tmp = 0; for(int i = 0; i < n; i++)tmp ^= data[i]; if(tmp == data[(int)data.size() - 1]){ vector <int> ans; for(int i = 0; i < n; i++)ans.push_back(data[i]); return ans; } int flipped = 0; for(int i = 0; (1 << i) < n; i++){ int x = 0; for(int j = 0; j < n; j++)if(j >> i & 1)x ^= data[j]; if(x != data[(int)data.size() - num + i])flipped ^= (1 << i); } data[flipped] = !data[flipped]; vector <int> ans; for(int i = 0; i < n; i++)ans.push_back(data[i]); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...