이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <cassert>
#include <map>
#include <complex>
#include <cmath>
#include <set>
#include "cave.h"
using namespace std;
void exploreCave (int n) {
vector<pair<int,bool>> vec;
int c[n]; int arr[n];
for (int i = 0; i < n; i++) {
int a[n];
for (int j = 0; j < n; j++) {
a[j] = true;
}
for (auto& p: vec) a[p.first] = p.second;
bool b = (tryCombination(a) >= i + 1 || tryCombination(a) == -1);
int l = 0;
int r = n - 1;
while (l != r) {
int m = (l + r)/2;
for (int j = 0; j < n; j++) a[j] = !b;
for (int j = 0; j <= m; j++) a[j] = b;
for (auto& p: vec) a[p.first] = p.second;
if (tryCombination(a) >= i + 1 || tryCombination(a) == -1) {
r = m;
} else {
l = m + 1;
}
}
arr[l] = i;
vec.emplace_back(l, b);
}
for (auto& p: vec) {
c[p.first] = p.second;
}
answer(c, arr);
}
# | 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... |