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[sw] = closed;
unknown.erase(sw);
break;
}
else if (newClosed < closed)
{
s[sw] = newClosed;
unknown.erase(sw);
c[sw] = invert(c[sw]);
}
}
closed = tryCombination(c);
}
for (int sw : unknown)
{
c[sw] = invert(c[sw]);
closed = tryCombination(c);
s[sw] = closed;
c[sw] = invert(c[sw]);
}
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... |