제출 #1135061

#제출 시각아이디문제언어결과실행 시간메모리
1135061poatXoractive (IZhO19_xoractive)C++20
0 / 100
1 ms408 KiB
#include "interactive.h" // #include "grader.cpp" #include <bits/stdc++.h> using namespace std; set<int> G(vector<int> vec, int n, int a1) { vector<int> v1 = get_pairwise_xor(vec); vec.push_back(a1); vector<int> v2 = get_pairwise_xor(vec); map<int, int> mp; for(auto i : v2) mp[i]++; for(auto i : v1) mp[i]--; for(auto &i : mp) i.second /= 2; set<int> res; for(auto i : mp) { if(i.second == 0) continue; res.insert(i.first ^ a1); } return res; } struct Node { int l, r; set<int> v; }; vector<int> guess(int N) { int n = N; int a1 = ask(1); vector<Node> vec; vector<int> V; for(int i = 2; i <= n; i++) V.push_back(i); set<int> ssss = G(V, n, a1); vec.push_back({2, n, ssss}); for(auto i : vec[0].v) cout << i << ' '; exit(0); while(1) { V.clear(); for(auto i : vec) { if(i.l == i.r) continue; int m = (i.l + i.r) / 2; for(int j = i.l; j <= m; j++) V.push_back(j); } if(V.size() == 0) break; set<int> S = G(V, n, a1); vector<Node> v2; for(auto i : vec) { if(i.l == i.r) { v2.push_back(i); continue; } int m = (i.l + i.r) / 2; set<int> s1, s2 = i.v; for(auto j : i.v) { if(S.find(j) == S.end()) continue; s2.erase(j); s1.insert(j); } v2.push_back({i.l, m, s1}); v2.push_back({m + 1, i.r, s2}); } vec = v2; } vector<int> res(n); res[0] = a1; for(auto i : vec) res[i.l - 1] = *i.v.begin(); // for(auto i : res) // cout << i << ' '; // cout << "\n"; // exit(0); return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...