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>
#include <ext/pb_ds/assoc_container.hpp>
//#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("avx,avx2,fma")
using namespace std;
using namespace __gnu_pbds;
#define fi first
#define se second
#define all(m) (m).begin(), (m).end()
#define rall(m) (m).rbegin(), (m).rend()
#define vec vector
#define sz(a) (int) (a).size()
#define mpp make_pair
#define mtt make_tuple
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair <ll, ll> pll;
typedef pair <int, int> pii;
typedef tuple <int, int, int> tui;
template <typename T>
using prq = priority_queue <T>;
template <typename T>
using pgq = priority_queue <T, vec <T>, greater <T>>;
template <typename T> bool umin(T &a, T b) { return a > b ? a = b, 1 : 0; }
template <typename T> bool umax(T &a, T b) { return a < b ? a = b, 1 : 0; }
const int L = 7;
vec <int> guess(int n){
vec <int> ans(n);
vec <vec <int>> vals(L);
vec <int> al;
ans[0] = ask(1);
for (int b = 0; b < L; ++b){
vec <int> ii;
for (int i = 1; i < n; ++i){
if (i >> b & 1) ii.push_back(i + 1);
}
if (ii.empty()) break;
vec <int> v1 = get_pairwise_xor(ii);
ii.push_back(1);
vec <int> v2 = get_pairwise_xor(ii);
multiset <int> s(all(v2));
for (auto &i: v1) s.erase(s.find(i));
s.erase(s.find(0));
vec <int> res(all(s));
sort(all(res));
res.erase(unique(all(res)), res.end());
for (auto &i: res){
vals[b].push_back(i ^ ans[0]);
al.push_back(i ^ ans[0]);
}
}
sort(all(al));
al.erase(unique(all(al)), al.end());
for (auto &i: al){
int pos = 0;
for (int j = 0; j < L; ++j){
if (count(all(vals[j]), i)) pos |= 1 << j;
}
ans[pos] = i;
}
return ans;
}
//inline int solve(){
//
// return 0;
//}
//
//inline void precalc(){}
//signed main(){
// ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// int tst = 1; //cin >> tst;
// precalc();
// while(tst--) solve();
// return 0;
//}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |