# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
257521 | BThero | Xoractive (IZhO19_xoractive) | C++17 | 6 ms | 512 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// chrono::system_clock::now().time_since_epoch().count()
#include<bits/stdc++.h>
#include "interactive.h"
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define debug(x) cerr << #x << " = " << x << endl;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
int n;
vi arr;
void print(vi x) {
fprintf(stderr, "%d:", x.size());
for (int y : x) {
fprintf(stderr, " %d", y);
}
fprintf(stderr, "\n");
}
int query(int x) {
return ask(x + 1);
}
vi query(vi x) {
for (int &y : x) {
++y;
}
return get_pairwise_xor(x);
}
vi guess(int _n) {
n = _n;
arr = vi(n, 0);
arr[0] = query(0);
map<int, int> idx;
for (int i = 0; (1 << i) < n; ++i) {
vi A;
for (int j = 1; j < n; ++j) {
if ((j >> i) & 1) {
A.pb(j);
}
}
vi B = query(A);
A.pb(0);
vi C = query(A);
map<int, int> cnt;
for (int x : B) {
--cnt[x];
}
for (int x : C) {
++cnt[x];
}
for (auto it : cnt) {
if (it.fi != 0 && it.se > 0) {
idx[it.fi ^ arr[0]] += (1 << i);
}
}
}
for (auto it : idx) {
arr[it.se] = it.fi;
}
return arr;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |