# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
954548 | boris_mihov | Xoractive (IZhO19_xoractive) | C++17 | 4 ms | 848 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "interactive.h"
#include <vector>
#include <map>
#include <set>
const int MAXN = 100 + 10;
std::map <int,int> map;
std::vector <int> query(std::vector <int> v)
{
std::vector <int> res;
for (int &i : v) i++;
std::vector <int> returned = get_pairwise_xor(v);
for (int i = v.size() ; i < returned.size() ; i += 2)
{
res.push_back(returned[i]);
}
return res;
}
std::vector <int> guess(int n)
{
std::vector <int> result(n);
result[0] = ask(1);
for (int bit = 0 ; (1 << bit) < n ; ++bit)
{
std::vector <int> v;
for (int i = 1 ; i < n ; ++i)
{
if (i & (1 << bit))
{
v.push_back(i);
}
}
if (v.empty())
{
continue;
}
std::vector <int> without = query(v); v.push_back(0);
std::vector <int> with = query(v);
std::multiset <int> vals;
for (const int &val : with)
{
vals.insert(val);
}
for (const int &val : without)
{
vals.erase(vals.find(val));
}
int last = -1;
for (const int &val : vals)
{
if (val == last)
{
continue;
}
map[val ^ result[0]] |= (1 << bit);
last = val;
}
}
for (const auto &[key, value] : map)
{
result[value] = key;
}
return result;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |