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 <vector>
#include <set>
using namespace std;
int c[5000];
int s[5000];
int invert(int bit)
{
return bit * -1 + 1;
}
void exploreCave(int N)
{
set<int> unknown;
for (int i = 0; i < N; i++)
{
unknown.insert(i);
}
int closed, newClosed;
closed = tryCombination(c);
while (closed != -1)
{
for (int sw : unknown)
{
c[sw] = invert(c[sw]);
newClosed = tryCombination(c);
if (newClosed > closed || newClosed == -1)
{
s[closed] = sw;
unknown.erase(sw);
break;
}
else if (newClosed < closed)
{
s[newClosed] = sw;
unknown.erase(sw);
c[sw] = invert(c[sw]);
}
}
closed = tryCombination(c);
}
answer(c, s);
}
# | 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... |