# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
501696 | BY_KUTBILIM | Xoractive (IZhO19_xoractive) | C++17 | 0 ms | 0 KiB |
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;
multiset<int> ss, st;
set<int> ka;
int f[109];
void mul(vector<int> q){
for(int h = 0; h < q.size(); h++){
if(q[h] == 0) continue;
st.insert(q[h]);
}
}
vector<int> ans[109];
vector<int> guess(int n){
vector<int> pas;
f[0] = ask(1);
for(int i = 0;; i++){
if((1 << i) >= n)break;
vector<int> v;
for(int j = 1; j < n; j++){
if((1<<i)&j)v.push_back(j+1);
}
st.clear();
mul(get_pairise_xor(v));
ss = st; st.clear();
v.push_back(1);
mul(get_pairise_xor(v));
multiset<int>::iterator it;
for(it = ss.begin(); it != ss.end(); it++){
s.erase(s.lower_bound((*it)));
}
ka.clear();
set<int>::iterator t;
for(it = s.begin(); it != s.end(); it++)ka.insert((*it));
for(t=ka.begin(); t != ka.end(); t++){
ans[i].push_back((*t));
}
}
pas.push_back(f[0]);
for(int i = 1; i < n; i++){
int x = 0;
m.clear();
for(int j = 0; j < 10; j++){
if((1<<j)&i) x++;
for(int jj = 0; jj < ans[j].size(); jj++){
if((1<<j)&i!=0) m[ans[j][jj]]++; else m[ans[j][jj]]--;
}
}
for(tt = m.begin(); tt!=m.end(); tt++){
if((*tt).second=x){
pas.push_back(((*tt).first^f[0]));
break;
}
}
}
return pas;
}