#include "interactive.h"
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cstring>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template<typename T, typename V>
void __print(const pair<T, V> &x) {
cerr << '{';
__print(x.first);
cerr << ',';
__print(x.second);
cerr << '}';
}
template<typename T>
void __print(const T &x) {
int f = 0;
cerr << '{';
for (auto &i: x) cerr << (f++ ? "," : ""), __print(i);
cerr << "}";
}
void _print() { cerr << "]\n"; }
template<typename T, typename... V>
void _print(T t, V... v) {
__print(t);
if (sizeof...(v)) cerr << ", ";
_print(v...);
}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define ff first
#define sc second
#define pb push_back
#define ll long long
#define pll pair<ll, ll>
#define pii pair <int, int>
#define ull unsigned long long
// #define int long long
// #define int unsigned long long
const ll inf = 1e9 + 7;
const ll weirdMod = 998244353;
vector<int> opr(vector<int> cur) {
map<int, int> cnt; cur.pb(1);
vector<int> x = get_pairwise_xor(cur);
cur.pop_back();
vector<int> y = get_pairwise_xor(cur);
for (int v : x) cnt[v]++;
for (int v : y) {
cnt[v]--;
if (cnt[v] == 0)
cnt.erase(v);
} cnt.erase(0);
vector<int> ans;
for (auto v : cnt)
ans.pb(v.ff);
return ans;
}
vector<int> guess(int n) {
int val = ask(1);
vector<int> vec[10];
for (int i = 1; i <= n; i++) {
for (int j = 0; j < 7; j++) {
if ((i >> j) % 2 == 1) vec[j].pb(i);
}
} map<int, int> mp;
for (int i = 0; i < 7; i++) {
vector<int> cur = opr(vec[i]);
for (int v : cur) mp[v] += (1 << i);
} vector<int> ans(n);
for (auto v : mp)
ans[v.sc] = (val ^ v.ff);
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Not unique |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Not unique |
2 |
Halted |
0 ms |
0 KB |
- |