# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
370452 | casperwang | Xoractive (IZhO19_xoractive) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "interactive.h"
#include <bits/stdc++.h>
#define pb push_back
using namespace std;
#define debug(args) kout("[ " + string(#args) + " ]", args)
void kout() { cerr << endl; }
template <class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ',kout(b...); }
template <class T> void pary(T L, T R) { while (L != R) cerr << *L << " \n"[++L==R]; }
vector<int> guess(int n) {
vector <int> G;
for (int i = 2; i <= n; i++)
G.pb(i);
vector <int> exp = get_pairwise_xor(G);
G.pb(1);
vector <int> all = get_pairwise_xor(G);
vector <int> ans(n);
set <int> nums;
ans[0] = ask(1);
for (int i = 0, j = 0; i < exp.size(); i++) {
while (all[j] != exp[i])
nums.insert(all[j++] ^ ans[0]);
}
while (j < all.size()) nums.insert(all[j++] ^ ans[0]);
assert(nums.size() == n);
return ans;
}