# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
486040 | Ronin13 | Xoractive (IZhO19_xoractive) | C++14 | 8 ms | 584 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>
#define ll long long
#define ull unsigned ll
#define pb push_back
#include "interactive.h"
using namespace std;
vector<int> guess(int n) {
vector <int> ans(n);
ans[n-1]=ask(n);
set<int>st[7];
for(int pos=0;pos<=6;pos++){
vector<int>a;
for(int j=0;j<n-1;j++){
if(j&(1<<pos))continue;
else a.pb(j+1);
}
int len=a.size();
vector<int>vec=get_pairwise_xor(a);
multiset<int>x,y;
for(int j=len;j<vec.size();j+=2)x.insert(vec[j]);
a.pb(n);
vector<int>vec1=get_pairwise_xor(a);
for(int j=len+1;j<vec1.size();j+=2)y.insert(vec1[j]);
for(int to:x){
y.erase(y.find(to));
}
for(int to:y){
st[pos].insert(to^ans[n-1]);
}
}
for(int i=0;i<n-1;i++){
vector<int>vec;
for(int j=0;j<=6;j++){
if(i&(1<<j))continue;
vec.pb(j);
}
for(int to:st[vec[0]]){
bool indic=true;
for(int j=1;j<vec.size();j++){
int ind=vec[j];
if(st[ind].find(to)==st[ind].end()){
indic=false;
break;
}
}
if(indic){
ans[i]=to;
for(int j=0;j<vec.size();j++){
int ind=vec[j];
st[ind].erase(st[ind].find(ans[i]));
}
break;
}
}
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |