#include "bits/stdc++.h"
#include "interactive.h"
using namespace std;
vector<int> guess(int n){
if(n == 2)
return {ask(1) ,ask(2)};
vector <int> ans(n); ans[0] = ask(1);
map <int ,int> pos;
int lg2 = 31-__builtin_clz(n);
for(int b=0; b<=lg2; b++){
vector <int> ids{1};
for(int i=2; i<=n; i++)
if(i&(1<<b))
ids.push_back(i);
auto vv = get_pairwise_xor(ids);
multiset <int> vals = multiset<int>{vv.begin() ,vv.end()};
ids.erase(ids.begin());
for(int r : get_pairwise_xor(ids))
vals.erase(vals.find(r));
for(int r : vals)
pos[r^ans[0]] |= (1<<b);
}
for(auto&p : pos)
ans[p.second-1] = p.first;
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
5 ms |
384 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
512 KB |
Output is not correct |
2 |
Halted |
0 ms |
0 KB |
- |