# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
345506 | koketsu | Xoractive (IZhO19_xoractive) | C++14 | 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 "interactive.h"
#include <iostream>
#include <set>
#include <map>
#define LL long long
#define pb push_back
using namespace std;
int Ans[101];
vector <int> Pos[101];
multiset <int> get(int A){
vector <int> E = get_pairwise_xor(Pos[A]);
multiset <int> Q;
for(int i : E){
Q.insert(i);
}
return Q;
}
vector <int> guess(int n){
int A = ask(1);
Ans[true] = A;
for(int i = 0; i < 7; i++){
for(int j = 2; j <= n; j++){
if(j & (1 << i)) pos[i].pb(j);
}
}
for(int i = 0; i < 7; i++){
if(!Pos[i].size()) continue;
multiset <int> A1 = get(i);
pos[i].pb(1);
multiset <int> A2 = get(i);
//A2.erase(A2.find(0));
for(auto it : A1){
A2.erase(A2.find(it));
}
for(auto it : A2){
Boo[i].pb(it ^ Ans[1]);
}
}
map <int, int> Mp;
for(int i = 0; i < 7; i++){
for(int j : Boo[i]){
Mp[j] |= j;
}
}
for(int i = 0; i < 7; i++){
for(int j : Boo[i]){
Ans[Mp[j]] = j;
}
}
vector <int> Dum;
for(int i = 1; i <= n; i++){
Dum.pb(Ans[i]);
}
return Ans;
}