이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "interactive.h"
#include <map>
using namespace std;
map<int, int> ra;
map<int, int> ask_compr(vector<int> pos) {
vector<int> ansv = get_pairwise_xor(pos);
map<int, int> ansmp;
for (auto x : ansv)
++ansmp[x];
return ansmp;
}
void get_bit(int n, int bt) {
vector<int> pos;
for (int i = 1; i <= n; ++i) {
if (i & bt)
pos.push_back(i);
}
map<int, int> mp0 = ask_compr(pos);
pos.push_back(n + 1);
map<int, int> mp1 = ask_compr(pos);
for (auto [x, cnt] : mp1) {
if (cnt > mp0[x]) {
ra[x] += bt;
}
}
}
vector<int> guess(int n) {
vector<int> ans(n);
ans[n - 1] = ask(n);
for (int bt = 1; bt + 1 < n; bt *= 2) {
get_bit(n - 1, bt);
}
for (auto [avl, i] : ra)
ans[i - 1] = avl ^ ans[n - 1];
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |