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<bits/stdc++.h>
using namespace std;
#include"interactive.h"
#define N 105
vector<int> guess(int n){
int i,j,ia,ib;
map<int,int> mp;
vector<int> ans(n);
ans[n-1]=ask(n);
for(i=0;i<7;i++){
vector<int> v,a,b;
for(j=1;j<n;j++)if(j&(1<<i))v.push_back(j);
if(v.empty())continue;
a=get_pairwise_xor(v);
v.push_back(n);
b=get_pairwise_xor(v);
for(ia=a.size()-1,ib=b.size()-1;ia>=0&&ib>=0;ib--){
if(a[ia]==b[ib]){
a.pop_back();
swap(b[ib],b.back());
b.pop_back();
ia--;
}
}
for(auto x:b)mp[x^ans[n-1]]|=1<<i;
}
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... |