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>
#include "interactive.h"
using namespace std;
vector<int> a[8];
set<int> s[8];
int N;
int find(int l, int r, int lvl, int v){
if(r - l == 1) return l;
int m = (l + r) / 2;
if(s[lvl].find(v) == s[lvl].end())
return find(m, r, lvl+1, v);
else return find(l, m, lvl+1, v);
}
vector<int> guess(int n){
vector<int> ans(N=n);
ans[n-1] = ask(n);
for(int i=1; i<n; ++i) a[0].push_back(i);
for(int i=0; i<7; ++i)
for(int j=0; j<n-1; ++j)
if(!(j & (1<<i))) a[7-i].push_back(j+1);
for(int i=1; i<8 && !a[i].empty(); ++i){
vector<int> x = get_pairwise_xor(a[i]);
a[i].push_back(n);
vector<int> y = get_pairwise_xor(a[i]);
for(int j : x) y.erase(lower_bound(y.begin(), y.end(), j));
for(int j : y) if(j) s[i].insert(j ^ ans[n-1]), s[0].insert(j ^ ans[n-1]);
}
for(int i : s[0]) ans[find(1, 129, 1, i)-1] = i;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |