# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
344919 | Rakhmand | Xoractive (IZhO19_xoractive) | C++14 | 8 ms | 748 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 <set>
#include <map>
#include <iostream>
using namespace std;
int ans[110];
multiset<int> get(vector<int> v){
vector<int> kek = get_pairwise_xor(v);
multiset<int> ms;
for(int i = 0; i < kek.size(); i++){
ms.insert(kek[i]);
}
return ms;
}
vector<int> guess(int n) {
ans[1] = ask(1);
vector<int> pos[7];
for(int i = 2; i <= n; i++){
for(int j = 0; j < 7; j++){
if(((1 << j) & i) > 0){
pos[j].push_back(i);
}
}
}
vector<int> good[7];
for(int i = 0; i < 7; i++){
if(pos[i].size() == 0) continue;
multiset<int> m1 = get(pos[i]);
pos[i].push_back(1);
multiset<int> m2 = get(pos[i]);
m2.erase(m2.find(0));
for(auto it : m1){
m2.erase(m2.find(it));
}
for(auto it : m2) {
good[i].push_back((it ^ ans[1]));
}
}
map<int, int> mp;
for(int i = 0; i < 7; i++){
for(auto j : good[i]){
mp[j] |= (1 << i);
}
}
for(int i = 0; i < 7; i++){
for(auto j : good[i]){
ans[mp[j]] = j;
}
}
vector<int> lol;
for(int i = 1; i <= n; i++){
lol.push_back(ans[i]);
}
return lol;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |