# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
526615 | peuch | Xoractive (IZhO19_xoractive) | C++11 | 3 ms | 384 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;
vector<int> guess(int n) {
vector<int> ans(n);
map<int, int> id;
ans[n - 1] = ask(n);
for(int i = 0; i < 7; i++){
vector<int> qry;
for(int j = 1; j < n; j++)
if((1 << i) & j) qry.push_back(j);
if(qry.empty()) continue;
qry.push_back(n);
vector<int> p1 = get_pairwise_xor(qry);
qry.pop_back();
vector<int> p2 = get_pairwise_xor(qry);
int it = p1.size() - 1;
while(!p2.empty()){
if(p1[it] == p2.back()){
swap(p1[it], p1[p1.size() - 1]);
p1.pop_back();
p2.pop_back();
}
it--;
}
for(int j = 1; j < p1.size(); j++)
id[p1[j] ^ ans[n - 1]] |= (1 << i);
}
map<int, int> :: iterator it;
for(it = id.begin(); it != id.end(); it++)
ans[it->second - 1] = it->first;
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |