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);
int base=ask(1);
ans[0]=base;
map<int,int>res;
for(int i=0; i<7; ++i){
vector<int>v;
int bad=1;
for(int x=2; x<=n; ++x) if(x&(1<<i)) {v.push_back(x);bad=0;}
if(bad) continue;
vector<int>get=get_pairwise_xor(v);
v.push_back(1);
vector<int>GET=get_pairwise_xor(v);
map<int,int>mp;
for(int x:get) mp[x]++;
for(int x:GET){
mp[x]--;
if(mp[x]==-1 && x!=0) res[x^base]|=(1<<i);
}
}
for(auto [x,y]:res){
ans[y-1]=x;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |