# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
785058 | Hanksburger | Xoractive (IZhO19_xoractive) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "interactive.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> res[7], v, p, q, t;
vector<int> guess(int n)
{
int x=ask(1);
for (int i=0; i<=6; i++)
{
t.clear();
for (int j=2; j<=n; j++)
if (j&(1<<i))
t.push_back(j);
if (t.empty())
p.clear();
else
p=get_pairwise_xor(t);
t.push_back(1);
q=get_pairwise_xor(t);
for (int u:p)
q.erase(find(q.begin(), q.end(), u));
for (int j=1; j<q.size(); j+=2)
{
v.push_back(q[j]^x);
res[i].push_back(q[j]^x);
}
}
sort(v.begin(), v.end());
v.resize(unique(v.begin(), v.end()));
vector<int> ans(n);
ans[0]=x;
for (int u:v)
{
int ind=0;
for (int i=0; i<=6; i++)
if (find(res[i].begin(), res[i].end(), u)!=res[i].end())
ind|=1<<i;
ans[ind-1]=u;
}
return ans;
}