This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
int determine[5000];
int correspond[5000];
int ord[5000];
void DoSort (int left, int right)
{
if (left == right)
{
correspond[left] = ord[left];
return;
}
int pivot = tryCombination(determine);
int pivot_point = 0;
int r = right;
for (int i = left; i <= right; i++)
{
int o = correspond[i];
determine[correspond[o]] = !determine[correspond[o]];
int t = tryCombination(determine);
if (t != pivot)
{
correspond[i] = t;
if (t > pivot)
pivot_point = i;
}
else
correspond[i] = r--;
determine[correspond[o]] = !determine[correspond[o]];
}
determine[correspond[pivot_point]] = !determine[correspond[pivot_point]];
DoSort(pivot + 1, right);
}
void exploreCave(int N) {
for (int i = 0; i < N; i++)
determine[i] = rand() % 2;
for (int i = 0; i < N; i++)
correspond[i] = i;
DoSort(0, N);
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... |