이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cave.h"
#include <bits/stdc++.h>
#define all(x) begin(x),end(x)
using namespace std;
void exploreCave(int N) {
vector<pair<int, bool>> known;
for (int cur = 0; cur < N; cur++) {
vector<int> query1(N, 0);
for (auto& k : known)
query1[k.first] = k.second;
bool correctState = tryCombination(query1.data()) == cur;
int lo = 0;
int hi = N;
while (hi > lo + 1) {
int mid = (lo + hi) / 2;
vector<int> query(N, correctState);
for (int i = lo; i < mid; i++)
query[i] = !correctState;
for (auto& k : known)
query[k.first] = k.second;
if (tryCombination(query.data()) == cur) {
hi = mid;
} else {
lo = mid;
}
}
known.emplace_back(lo, correctState);
}
vector<int> S(N);
vector<int> D(N);
for (int i = 0; i < N; i++) {
S[known[i].first] = known[i].second;
D[known[i].first] = i;
}
answer(S.data(), D.data());
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |