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;
const int maxn=105;
int fir;
set<int>arr[10];
set<int>A(vector<int>v){
if(v.empty()) return set<int>();
vector<int>now = v;
now.push_back(1);
vector<int>nw = get_pairwise_xor(now);
vector<int>z = get_pairwise_xor(v);
multiset<int>SS(nw.begin(),nw.end());
for(auto i : z) SS.erase(SS.find(i));
set<int>jg;
for(auto i : SS) jg.insert(i ^ fir);
jg.erase(fir);
return jg;
}
set<int>un(set<int>A,set<int>B){
set<int>jog;
for(auto i : A) if(B.find(i) != B.end()) jog.insert(i);
return jog;
}
vector<int> guess(int n) {
fir = ask(1);
for(int i = 0;i <= 6;i++){
vector<int>now;
for(int j = 2;j <= n;j++) if((1 << i) & j) now.push_back(j);
arr[i] = A(now);
}
vector<int>ans; ans.push_back(fir);
for(int i = 2;i <= n;i++){
set<int>now;
for(int j = 0;j <= 6;j++){
if((1<<j) & i){
if(now.empty()) now = arr[j];
else now = un(now,arr[j]);
}
else for(auto k : arr[j]) now.erase(k);
}
assert(!now.empty());
ans.push_back(*now.begin());
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |