Submission #1155257

#TimeUsernameProblemLanguageResultExecution timeMemory
1155257steveonalexData Transfer (IOI19_transfer)C++20
32 / 100
122 ms1728 KiB
/* ________ ___ ________ ________ ________ ___ ________ ________ ________ |\ ____\|\ \|\ ____\|\ __ \ |\ ___ \|\ \|\ ____\|\ ____\|\ __ \ \ \ \___|\ \ \ \ \___|\ \ \|\ \ \ \ \\ \ \ \ \ \ \___|\ \ \___|\ \ \|\ \ \ \ \ __\ \ \ \ \ __\ \ __ \ \ \ \\ \ \ \ \ \ \ __\ \ \ __\ \ __ \ \ \ \|\ \ \ \ \ \|\ \ \ \ \ \ \ \ \\ \ \ \ \ \ \|\ \ \ \|\ \ \ \ \ \ \ \_______\ \__\ \_______\ \__\ \__\ \ \__\\ \__\ \__\ \_______\ \_______\ \__\ \__\ \|_______|\|__|\|_______|\|__|\|__| \|__| \|__|\|__|\|_______|\|_______|\|__|\|__| ________ ________ ________ ________ ___ ___ ________ _________ ___ ________ ________ |\ __ \|\ __ \|\ __ \|\ ___ \|\ \|\ \|\ ____\\___ ___\\ \|\ __ \|\ ___ \ \ \ \|\ \ \ \|\ \ \ \|\ \ \ \_|\ \ \ \\\ \ \ \___\|___ \ \_\ \ \ \ \|\ \ \ \\ \ \ \ \ ____\ \ _ _\ \ \\\ \ \ \ \\ \ \ \\\ \ \ \ \ \ \ \ \ \ \ \\\ \ \ \\ \ \ \ \ \___|\ \ \\ \\ \ \\\ \ \ \_\\ \ \ \\\ \ \ \____ \ \ \ \ \ \ \ \\\ \ \ \\ \ \ \ \__\ \ \__\\ _\\ \_______\ \_______\ \_______\ \_______\ \ \__\ \ \__\ \_______\ \__\\ \__\ \|__| \|__|\|__|\|_______|\|_______|\|_______|\|_______| \|__| \|__|\|_______|\|__| \|__| Written by: giga nigga */ // #include "largest.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; #define MASK(i) (1ULL << (i)) #define GETBIT(mask, i) (((mask) >> (i)) & 1) #define ALL(v) (v).begin(), (v).end() ll max(ll a, ll b){return (a > b) ? a : b;} ll min(ll a, ll b){return (a < b) ? a : b;} ll gcd(ll a, ll b){return __gcd(a, b);} ll lcm(ll a, ll b){return a / gcd(a, b) * b;} ll LASTBIT(ll mask){return (mask) & (-mask);} int pop_cnt(ull mask){return __builtin_popcountll(mask);} int ctz(ull mask){return __builtin_ctzll(mask);} int logOf(ull mask){return 63 - __builtin_clzll(mask);} // mt19937_64 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); mt19937_64 rng(1); ll rngesus(ll l, ll r){return l + (ull) rng() % (r - l + 1);} double rngesus_d(double l, double r){ double wow = (double) ((ull) rng()) / ((ull)(0-1)); return wow * (r - l) + l; } template <class T1, class T2> bool maximize(T1 &a, T2 b){ if (a < b) {a = b; return true;} return false; } template <class T1, class T2> bool minimize(T1 &a, T2 b){ if (a > b) {a = b; return true;} return false; } template <class T> void printArr(T container, string separator = " ", string finish = "\n", ostream &out = cout){ for(auto item: container) out << item << separator; out << finish; } template <class T> void remove_dup(vector<T> &a){ sort(ALL(a)); a.resize(unique(ALL(a)) - a.begin()); } #include "transfer.h" vector<int> get_attachment(vector<int> source) { vector<int> ans; int sum = 0; for(int i: source) sum ^= i; ans.push_back(sum); ans.push_back(sum); for(int j = 0; MASK(j) < source.size(); ++j){ int sum = 0; for(int i = 0; i < (int) source.size(); ++i) if (GETBIT(i, j)) sum ^= source[i]; ans.push_back(sum); } return ans; } vector<int> retrieve(vector<int> data) { int n = data.size(); if (n < 255) n = 62; else n = 255; int sum = 0; for(int i = 0; i < n; ++i) sum ^= data[i]; if (data[n] != data[n+1]) return vector<int>(data.begin(), data.begin() + n); else{ if (sum == data[n]) return vector<int>(data.begin(), data.begin() + n); else{ vector<int> ans(data.begin(), data.begin() + n); vector<int> sum_bit; for(int i = n+2; i < (int) data.size(); ++i) sum_bit.push_back(data[i]); int diff = 0; for(int j = 0; j < (int) sum_bit.size(); ++j){ int sum = 0; for(int i = 0; i < n; ++i) if (GETBIT(i, j)) sum ^= data[i]; if (sum != sum_bit[j]) diff += MASK(j); } ans[diff] ^= 1; return ans; } } } // int main(void){ // ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); // clock_t start = clock(); // int t = 1e5; // for(int it = 1; it <= t; ++it){ // if (it % 1000 == 0) // cout << "Testcase #" << it << "\n"; // int n = 62; // vector<int> a(n); // for(int &i: a) i += rngesus(0, 1); // vector<int> tmp = get_attachment(a); // vector<int> data = a; // for(int i: tmp) data.push_back(i); // int decision = rngesus(0, 1), pos = rngesus(0, data.size() - 1); // if (decision) { // data[pos] ^= 1; // } // vector<int> b = retrieve(data); // if (a != b){ // cout << "Wrong Answer!\n"; // printArr(a); // cout << decision << " " << pos << "\n"; // printArr(data); // printArr(b); // break; // } // } // cerr << "Time elapsed: " << clock() - start << "ms!\n"; // return 0; // }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...