#include "interactive.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> guess(int N) {
vector<int> ans(N);
ans[0] = ask(1);
map<int, int> inds;
for (int j = 0; (1 << j) <= N; j++) {
vector<int> v;
for (int i = 0; i < N; i++) {
if (i & 1 << j) {
v.push_back(i+1);
}
}
if (!v.size()) continue;
vector<int> a = get_pairwise_xor(v);
v.push_back(1);
vector<int> b = get_pairwise_xor(v);
set<int> s(b.begin(), b.end());
for (int i : a) {
if (s.count(i)) {
s.erase(i);
}
}
for (int i : s) {
if (i) {
inds[i^ans[0]] += 1 << j;
}
}
}
for (auto [a, b] : inds) {
ans[b] = a;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 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 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
336 KB |
Output is correct |
2 |
Correct |
3 ms |
336 KB |
Output is correct |
3 |
Incorrect |
2 ms |
336 KB |
Output is not correct |
4 |
Halted |
0 ms |
0 KB |
- |