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 <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define pb push_back
#define all(a) a.begin(), a.end()
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
vi guess(int n)
{
if (n <= 6) {
vi ans;
for (int i = 1; i <= n; ++i) {
ans.pb(ask(i));
}
return ans;
}
vi ans(n);
ans[0] = ask(1);
map<int, int> mp;
for (int i = 0; i < 7; ++i) {
vi v;
for (int j = 2; j <= n; ++j) {
if (1 << i & j) {
v.pb(j);
}
}
vi get = get_pairwise_xor(v);
v.pb(1);
vi Get = get_pairwise_xor(v);
map<int, int> cnt;
for (int j : Get) {
cnt[j]++;
}
for (int j : get) {
cnt[j]--;
}
for (auto j : cnt) {
if(j.x && j.y) {
mp[j.x ^ ans[0]] |= 1 << i;
}
}
}
for (auto i : mp) {
ans[i.y - 1] = i.x;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |