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 <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 = 2; 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);
ans[0] = val;
for (auto v : mp)
ans[v.sc - 1] = (val ^ v.ff);
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |