# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
339086 | nandonathaniel | Xoractive (IZhO19_xoractive) | C++14 | 6 ms | 620 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 "interactive.h"
#include "bits/stdc++.h"
using namespace std;
int arr[105];
map<int,int> balik;
vector<int> kurang(vector<int> a,vector<int> b){
map<int,int> byka,bykb;
vector<int> ret;
for(auto isi : a)byka[isi]++;
for(auto isi : b)bykb[isi]++;
for(map<int,int>::iterator it=byka.begin();it!=byka.end();++it){
if(it->first==0)continue;
int cnt=it->second-bykb[it->first];
for(int i=1;i<=cnt/2;i++)ret.push_back(it->first);
}
return ret;
}
vector<int> guess(int n) {
vector <int> ans;
int satu=ask(1);
arr[1]=satu;
for(int i=0;i<7;i++){
vector<int> v;
for(int j=2;j<=n;j++){
if((1<<i) & j){
v.push_back(j);
}
}
if(v.empty())continue;
vector<int> kecil=get_pairwise_xor(v);
v.push_back(1);
vector<int> besar=get_pairwise_xor(v);
vector<int> selisih=kurang(besar,kecil);
for(int j=0;j<selisih.size();j++){
selisih[j]^=satu;
balik[selisih[j]]+=(1<<i);
}
}
for(map<int,int>::iterator it=balik.begin();it!=balik.end();++it){
arr[it->second]=it->first;
}
for(int i=1;i<=n;i++)ans.push_back(arr[i]);
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |