이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 5005;
int n;
int ans[maxn];
int val[maxn];
int connection[maxn];
int guess[maxn];
void exploreCave(int N)
{
n = N;
vector<int> switches;
for (int i = 0; i < n; ++i)
{
switches.push_back(i);
}
for (int i = 0; i < n; ++i)
{
int curr_code = 1;
for (int j = 0; j < n; ++j)
{
guess[j] = 1;
}
if (tryCombination(guess) == i)
{
curr_code = 0;
}
int l = 0;
int r = switches.size() - 2;
while (l <= r)
{
int mid = (l + r) / 2;
for (int j = 0; j < i; ++j)
{
guess[ans[j]] = val[ans[j]];
}
for (int j = 0; j <= mid; ++j)
{
guess[switches[j]] = curr_code;
}
if (tryCombination(guess) == i)
{
l = mid + 1;
}
else
{
r = mid - 1;
}
}
ans[i] = switches[l];
val[switches[l]] = curr_code;
switches.erase(switches.begin() + l);
}
for (int i = 0; i < n; ++i)
{
connection[ans[i]] = i;
}
answer(val, connection);
}
# | 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... |