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 n, s[5010], firstclosed, d[5010], correct[5010], done;
bool mk[5010];
void exploreCave(int N) {
n = N;
firstclosed = tryCombination(s);
if(firstclosed == -1) firstclosed = n;
for(int i = 0; done < n; i = (i+1) % n)
{
if(mk[i]) continue;
s[i] ^= 1;
int pos = tryCombination(s);
if(pos == -1)
{
correct[i] = s[i];
d[i] = firstclosed;
done++;
firstclosed = n;
mk[i] = true;
continue;
}
if(pos < firstclosed)
{
correct[i] = s[i] ^ 1;
d[i] = pos;
done++;
s[i] ^= 1;
mk[i] = true;
}
if(pos > firstclosed)
{
correct[i] = s[i];
d[i] = firstclosed;
done++;
firstclosed = pos;
mk[i] = true;
}
}
for(int i = 0; i < n; i++)
s[i] = correct[i];
answer(s,d);
}
# | 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... |