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