#include <bits/stdc++.h>
#include "interactive.h"
#define pb push_back
#define F first
#define S second
using namespace std;
vector<int> guess(int n) {
int kec = ask(1);
map<int,int>rez;
for(int bit = 0; bit < 7; bit++) {
vector<int>v1;
for(int i = 2; i <= n; i++) if((1 << bit) & i) v1.pb(i);
if(v1.empty()) break;
vector<int>v2 = v1;
v2.pb(1);
vector<int>r1 = get_pairwise_xor(v1);
vector<int>r2 = get_pairwise_xor(v2);
map<int,int>m;
for(int j : r2) m[j] += 1;
for(int j : r1) m[j] -= 1;
m[0] -= 1;
for(auto X : m) {
if(X.S > 0) {
rez[X.F ^ kec] += 1 << bit;
}
}
}
vector<int>ans(n);
ans[0] = kec;
for(auto X : rez) ans[X.S - 1] = X.F;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |