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"
using namespace std;
#include <bits/stdc++.h>
vector<int> guess(int n);
vector<int>guess(int n) {
vector<int>ans(n);
ans[0]=ask(1);
map<int,int>ans_pos;
for(int bit=0;bit<7;bit++){
vector<int>pos;
for(int i=2;i<=n;i++){
if(i&(1<<bit)){
pos.push_back(i);
}
}
if(pos.empty())break;
vector<int>q1=get_pairwise_xor(pos);
pos.push_back(1);
vector<int>q2=get_pairwise_xor(pos);
map<int,int>cnt;
for(auto x:q2){
cnt[x]++;
}
for(auto x:q1){
cnt[x]--;
}
for(auto t:cnt){
if(t.first!=0 && t.second != 0) {
ans_pos[t.first^ans[0]]+=(1<<bit);
}
}
}
for(auto q:ans_pos){
ans[q.second-1]=q.first;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |