# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
618820 | 2022-08-02T07:44:09 Z | MetalPower | Xoractive (IZhO19_xoractive) | C++14 | 0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; #include "interactive.h" // ask(i) := returns value at i // get_pairwise_vector(vec) := returns a set of pairwise xor's map<int, int> loc; vector<int> guess(int n){ int lst = ask(n); for(int bt = 0; bt < 7; bt++){ vector<int> vec; for(int i = 0; i < n - 1; i++) if(i & (1 << bt)) vec.push_back(i + 1); vector<int> st = get_pairwise_vector(vec); vec.push_back(n); vector<int> fn = get_pairwise_vector(vec); vector<int> vals; for(int i = 0, j = 0; i < (int) st.size(); i++, j++){ while(j < (int) fn.size() && fn[j] != st[i]) vals.push_back(fn[j++]); } for(int j = 1; j < (int) st.size(); j++) loc[st[j]] ^= 1 << bt; } vector<int> ans; ans.resize(n, 0); for(auto x : loc) ans[x.second] = x.first; ans[n - 1] = lst; return ans; }