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>
using namespace std;
vector<int> guess(int n) {
vector<int> ans;
multiset<int> diff[7], rep[7];
set<int> s;
ans.resize(n,-1);
ans[0] = ask(1);
for (int i = 0; i < 7; ++i){
vector<int> x, y;
x.push_back(1);
for (int j = 2; j <= n; ++j){
if (!(j & (1 << i))){
x.push_back(j);
y.push_back(j);
}
}
vector<int> xr = get_pairwise_xor(x), yr = get_pairwise_xor(y);
for (auto it : xr){
diff[i].insert(it);
}
for (auto it : yr){
diff[i].erase(diff[i].find(it));
}
diff[i].erase(0);
for (auto it : diff[i]){
rep[i].insert(it ^ ans[0]);
}
for (auto it : rep[i]){
s.insert(it);
}
}
for (auto it : s){
int num = (1 << 7) - 1;
for (int i = 0; i < 7; ++i){
if (rep[i].find(it) != rep[i].end()){
num -= (1 << i);
}
}
ans[num-1] = it;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |