이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bits/stdc++.h"
#include "interactive.h"
using namespace std;
vector<int> guess(int n) {
if(n <= 4) {
vector<int> ans(n, 0);
for(int i = 0; i < n; ++i) ans[i] = ask(i + 1);
return ans;
}
vector<int> ans(n, 0);
ans[0] = ask(1);
map<int, int> pos;
for(int i = 0; i < 7; ++i) {
vector<int> v;
for(int j = 1; j < n; ++j) {
if(j >> i & 1) {
v.push_back(j + 1);
}
}
vector<int> A = get_pairwise_xor(v);
v.push_back(1);
vector<int> B = get_pairwise_xor(v);
map<int, int> cnt;
for(auto x: A) if(x) ++cnt[x];
for(auto x: B) if(x) --cnt[x];
for(auto x: cnt) {
if(x.second) {
pos[x.first ^ ans[0]] += (1 << i);
}
}
}
for(auto x: pos) ans[x.second] = x.first;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |