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(n);
ans[0] = ask(1);
map<int,int> pos;
for(int i = 0;i<=6;i++){
if((1<<i) > n)break;
vector<int> tmp;
for(int j = 2;j<=n;j++){
if(j & (1<<i))
tmp.push_back(j);
}
vector<int> a = get_pairwise_xor(tmp);
map<int,int> mp;
tmp.push_back(1);
vector<int> b = get_pairwise_xor(tmp);
for(auto u:a){
if(u)
mp[u]--;
}
for(auto u:b){
if(u)
mp[u]++;
}
for(auto u:mp){
if(u.second == 0)continue;
pos[u.first ^ ans[0]] += (1<<i);
}
}
for(auto u:pos){
ans[u.second-1] = u.first;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |