#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 = 0; i < n; ++i){
if (i >> b & 1) ii.push_back(i + 1);
}
if (ii.empty()) break;
vec <int> vv = get_pairwise_xor(ii);
sort(all(vv));
vv.erase(unique(all(vv)), vv.end());
ii.push_back(1);
vec <int> vv1 = get_pairwise_xor(ii);
sort(all(vv1));
vv1.erase(unique(all(vv1)), vv1.end());
for (auto &i: vv1){
if (!count(all(vv), i)){
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;
//}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
288 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
7 ms |
336 KB |
Output is correct |
2 |
Correct |
6 ms |
340 KB |
Output is correct |
3 |
Incorrect |
2 ms |
336 KB |
Output is not correct |
4 |
Halted |
0 ms |
0 KB |
- |