#include <bits/stdc++.h>
#include "interactive.h"
#define respagold ios_base::sync_with_stdio(0), cin.tie(0);
//#define int long long
#define ll long long
#define int2 __int128_t
#define FOR( i, x, n, d ) for( int i = x; i <= n; i += d )
#define FORR( i, x, n, d ) for( int i = x; i >= n; i -= d )
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x.size())
#define pb push_back
#define ins insert
#define lb lower_bound
#define ub upper_bound
#define pii pair <int, int>
#define mkp make_pair
using namespace std;
const int N = 3e5 + 123;
const int inf = 1e9;
const int mod = 1e9 + 7;
int a[N], b[N], c[N], n, m, k, z, w, x, y;
mt19937 rng( chrono::steady_clock::now().time_since_epoch().count());
int rand( int l, int r )
{
uniform_int_distribution <int> uid( l, r );
return uid( rng );
}
vector <int> guess( int n )
{
cin >> n;
vector <int> qu;
vector <int> answ(n);
map <int, int> mp, mp1;
answ[0] = ask(1);
FOR( bt, 0, log2(n), 1 )
{
qu.clear();
mp.clear();
FOR( i, 1, n, 1 )
{
if( ((i >> bt) & 1) ) qu.pb(i);
}
auto without = get_pairwise_xor(qu); qu.pb(1);
auto with = get_pairwise_xor(qu);
for( auto i : with ) mp[i] ++;
for( auto i : without ) mp[i] --;
for( auto i : mp ) if( i.S ) mp1[i.F ^ answ[0]] |= (1 << bt);
}
for( auto i : mp1 ) answ[i.S - 1] = i.F;
return answ;
}
//signed main()
//{
//// freopen("connect.in", "r", stdin);
//// freopen("connect.out", "w", stdout);
//
// respagold
//
// int test = 1;
//
// if( !test ) cin >> test;
//
// while( test -- )
// {
// solve();
// }
//}
//// solved by KluydQ
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |