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;
vector<int> guess(int n) {
map <int,int> mp;
vector <int> ans(n);
ans[0] = ask(1);
for (int b = 0; b < 7; b++) {
vector <int> v;
for (int i = 2; i <= n; i++){
if (((i >> b) & 1)) v.pb(i);
}
if (!v.size()) continue;
vector <int> ans1 = get_pairwise_xor(v);
v.pb(1);
vector <int> ans2 = get_pairwise_xor(v);
multiset <int> st1,st2;
for (int x: ans1) st1.insert(x);
for (int x: ans2) st2.insert(x);
while (st1.size()){
st2.erase(st2.find(*st1.begin()));
st1.erase(st1.begin());
}
st2.erase(st2.find(0));
for (int x: st2){
mp[x ^ ans[0]] |= (1<<b);
}
}
for (auto [x,y]: mp)
ans[y - 1] = x;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |