제출 #291958

#제출 시각아이디문제언어결과실행 시간메모리
291958dantoh000Xoractive (IZhO19_xoractive)C++14
100 / 100
7 ms640 KiB
#include <bits/stdc++.h> #include "interactive.h" using namespace std; int q1; int N; multiset<int> _S[7]; set<int> S[7]; void get(int x){ vector<int> v; for (int i = 2; i <= N; i++){ if (i>>x&1) v.push_back(i); } if (v.size() == 0){ return; } vector<int> o1 = get_pairwise_xor(v); v.push_back(1); vector<int> o2 = get_pairwise_xor(v); for (auto c : o2) { _S[x].insert(c^q1); } for (auto c : o1) _S[x].erase(_S[x].find(c^q1)); for (auto c : _S[x]){ if (_S[x].count(c) == 2){ S[x].insert(c); } } /*printf("set %d: ",x); for (auto c : S[x]) printf("%d ",c); printf("\n");*/ } vector<int> guess(int n) { N = n; q1 = ask(1); for (int i = 0; i <= 6; i++){ get(i); } vector<int> ans(n); set<int> fin; for (int i = 0; i <= 6; i++) for (auto c : S[i]) fin.insert(c); for (auto x : fin){ int id = 0; for (int i = 0; i <= 6; i++){ if (S[i].find(x) != S[i].end()) id += (1<<i); } //printf("id of %d is %d\n",x,id); ans[id-1] = x; } ans[0] = q1; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...