# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
551507 | 2022-04-20T22:14:45 Z | Olympia | Xoractive (IZhO19_xoractive) | C++17 | 0 ms | 0 KB |
#include <iostream> #include <vector> #include <iomanip> #include <algorithm> #include <cassert> #include <map> #include <complex> #include <cmath> #include <stdio.h> #include <string.h> #include <set> #include <queue> #include"interactive.h" using namespace std; vector<int> reduce (vector<int> v) { map<int,int> cnt; for (int i: v) { cnt[i]++; } cnt[0] = 0; v.clear(); for (auto& p: cnt) { p.second /= 2; while (p.second--) { v.push_back(p.first); } } return v; } int beginning; vector<int> permutation (vector<int> indices) { vector<int> v1 = reduce(get_pairwise_xor(indices)); indices.push_back(oracle.size() - 1); vector<int> v2 = reduce(get_pairwise_xor(indices)); map<int,int> cnt; for (int i: v2) cnt[i]++; for (int i: v1) cnt[i]--; vector<int> v; for (auto& p: cnt) { if (p.second) v.push_back(p.first ^ beginning); } sort(v.begin(), v.end()); return v; } vector<int> solve (int n) { beginning = ask((int)oracle.size() - 1); map<int,int> m; for (int i = 0; i < 7; i++) { vector<int> x; for (int j = 0; j < n - 1; j++) { if ((j + 1) & (1 << i)) { x.push_back(j); } } vector<int> a = permutation(x); for (int val: a) { m[val] |= (1 << i); } } vector<int> ans(n); for (auto& p: m) { ans[p.second - 1] = p.first; } return ans; }