Submission #881270

#TimeUsernameProblemLanguageResultExecution timeMemory
881270Chal1shkanXoractive (IZhO19_xoractive)C++17
94 / 100
4 ms852 KiB
# include "interactive.h" # include <bits/stdc++.h> # define pb push_back # define ff first # define ss second # define nl "\n" # define sz(x) ((int)(x).size()) # define all(x) (x).begin(), (x).end() # define deb(x) cerr << #x << " = " << x << endl; # define pll pair <ll, ll> # define pii pair <int, int> typedef long long ll; typedef unsigned long long ull; typedef long double ld; const ll maxn = (ll)2e5 + 7; const ll inf = (ll)2e18 + 0; const ll mod = (ll)1e9 + 7; const ll dx[] = {-1, 1, 0, 0}; const ll dy[] = {0, 0, -1, 1}; using namespace std; mt19937 rng(239017); vector <int> guess (int n) { vector <int> ans(n, 0); ans[0] = ask(1); map <int, int> mp[7]; set <int> st; for (int bit = 0; bit < 7; ++bit) { vector <int> q[2]; for (int i = 2; i <= n; ++i) { if (i & (1LL << bit)) { q[0].pb(i); q[1].pb(i); } } q[1].pb(1); map <int, int> cnt; q[0] = get_pairwise_xor(q[0]); q[1] = get_pairwise_xor(q[1]); for (int x : q[1]) cnt[x]++; for (int x : q[0]) cnt[x]--; for (auto [x, y] : cnt) { if (y == 2) { int num = ans[0] ^ x; mp[bit][num]++; st.insert(num); } } } for (int x : st) { int id = 0; for (int bit = 0; bit < 7; ++bit) { if (mp[bit][x]) { id += (1LL << bit); } } ans[id - 1] = x; } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...