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>
#define REP(v, i, j) for (int v = i; v != j; v++)
#define FORI(v) for (auto i : v)
#define FORJ(v) for (auto j : v)
#define OUT(v, a) \
FORI(v) \
cout << i << a;
#define OUTS(v, a, b) \
cout << v.size() << a; \
OUT(v, b)
#define in(a, n) \
REP(i, 0, n) \
cin >> a[i];
#define SORT(v) sort(begin(v), end(v))
#define REV(v) reverse(begin(v), end(v))
#define MEMSET(m) memset(m, -1, sizeof m)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define pb push_back
#define fi first
#define se second
#define detachIO \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
using namespace std;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<pii, pii> piiii;
vector<int> getarr(int n, int mask, int a) {
vector<int> q;
REP(i,1,n+1)if(i&mask)q.pb(i);
if(q.size()==0)return {};
vector<int> res1=get_pairwise_xor(q);
q.pb(n+1);
vector<int> res2=get_pairwise_xor(q);
multiset<int> st;
FORI(res2)st.insert(i);
FORI(res1)st.erase(st.lower_bound(i));
vector<int> ans;
FORI(st){
if(i==0)continue;
ans.pb(a^i);
}
return ans;
}
vector<int> guess(int n, int a) {
map<int,int> mp;
REP(i,0,12)FORJ(getarr(n,1<<i,a))mp[j]|=1<<i;
vector<int> ans;
ans.resize(n+1);
ans[n]=a;
FORI(mp)ans[i.se-1]=i.fi;
return ans;
}
vector<int> guess(int n) {
return guess(n-1, ask(n));
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |