이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
int determine[5000];
int correspond[5000];
vector<int> undone;
int undones;
void exploreCave(int N) {
for (int i = 0; i < N; i++)
determine[i] = rand() % 2, correspond[i] = i, undone.push_back(i);
undones = N;
while (undones > 0)
{
int pivot = tryCombination(determine);
int pivot_point = 0;
int r = N;
if (pivot == -1)
break;
bool flag = false;
for (int p : undone)
{
int o = correspond[p];
determine[correspond[o]] = !determine[correspond[o]];
int t = tryCombination(determine);
if (t == -1)
{
flag = true;
break;
}
if (t != pivot)
{
undone.erase(undone.begin() + p), undones--;
correspond[p] = t;
if (t > pivot)
pivot_point = p;
}
else
correspond[p] = --r;
determine[correspond[o]] = !determine[correspond[o]];
}
if (flag)
break;
determine[correspond[pivot_point]] = !determine[correspond[pivot_point]];
}
while (undones > 0)
{
int o = undone[0];
determine[o] = !determine[o];
int t = tryCombination(determine);
correspond[o] = t, undone.erase(undone.begin()), undones--;
determine[o] = !determine[o];
}
answer(determine, correspond);
}
# | 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... |