이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "interactive.h"
// #include "grader.cpp"
#define ok puts("ok");
using namespace std;
vector <int> ans;
vector<int> guess(int n) {
map <int, int> ind;
ans.resize(n, ask(1));
for (int i = 0; i < 7; i++) {
vector <int> vec;
for (int j = 2; j <= n; j++) {
if ((j >> i) & 1) {
vec.push_back(j);
}
}
if (vec.empty()) continue;
vector <int> vv = vec;
vv.push_back(1);
vv = get_pairwise_xor(vv);
vec = get_pairwise_xor(vec);
map <int, int> cnt;
for (int to : vv) {
if (to != 0)
cnt[to]++;
}
for (int to : vec) {
if (to != 0)
cnt[to]--;
}
// cout << i << "# \n";
for (int to : vv) {
if (cnt[to] == 0) continue;
// cout << (to.first ^ ans[0]) << ' ' << to.second << endl;
ind[to ^ ans[0]] |= (1 << i);
}
}
for (auto to : ind) {
// cout << to.first << ' ' << to.second << endl;
ans[to.second - 1] = to.first;
}
return ans;
}
/*
10
1 2 3 4 5 1 2 3 4 5
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |