#include <bits/stdc++.h>
#include "interactive.h"
using namespace std;
#define threesum cin.tie(NULL); cout.tie(NULL); ios_base::sync_with_stdio(false)
#define all(a) a.begin(), a.end()
#define F first
#define S second
//#define int long long
#define double long double
#define pii pair<int, int>
#define ppp pair<int, pii>
#define dout cout << fixed << setprecision(15)
#define mid ((l + r) / 2)
#define lc (2 * id)
#define rc (lc + 1)
//const int maxn = 3e5 + 10, maxm = 1e3 + 10, oo = 1e18 + 10, lg = 8, sq = 350, mod = 1e9 + 7;
vector<int> guess(int n){
vector<int> a(n + 1);
a[1] = ask(1);
map<int, int> cnt[110];
for (int b = 0; b < 7;b++){
vector<int> u, v, f;
for (int i = 2; i <= n; i++)
if(i & (1ll << b))
v.push_back(i);
if(!v.size())
continue;
u = get_pairwise_xor(v);
v.push_back(1);
f = get_pairwise_xor(v);
multiset<int> s;
for(auto i : f)
s.insert(i);
for(auto i : u)
s.erase(s.find(i));
for(auto i : v)
if(i != 1)
for(auto j : s)
cnt[i][j ^ a[1]]++;
}
for (int i = 2; i <= n;i++)
for(auto [x, y] : cnt[i])
if(y == __builtin_popcount(i))
a[i] = x;
return a;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |