제출 #550057

#제출 시각아이디문제언어결과실행 시간메모리
550057palilo동굴 (IOI13_cave)C++17
0 / 100
334 ms416 KiB
#include "cave.h" #include <bits/stdc++.h> void exploreCave(int n) { using namespace std; vector<int> s(n), d(n, -1), query(n), unknown(n); iota(unknown.begin(), unknown.end(), 0); auto solve = [&](int door_id) { const auto res_if_0 {tryCombination(query.data()) == door_id}; // const auto lo {unknown.begin()}, hi{unknown.end()}; int lo {}, hi {static_cast<int>(unknown.size()) - 1}; while (lo != hi) { const auto mid {(lo + hi) >> 1}; for (int i = lo; i < mid; ++i) { query[unknown[i]] = 1; } const auto res {tryCombination(query.data()) == door_id}; for (int i = lo; i < mid; ++i) { query[unknown[i]] = 0; } res == res_if_0 ? lo = mid + 1 : hi = mid; } s[lo] = res_if_0; d[lo] = door_id; }; for (int i = 0; i < n; ++i) { solve(i); } answer(s.data(), d.data()); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...