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;
void exploreCave(int n)
{
int sw[n], st[n], temp[n];
for (int i = 0; i < n; i++)
st[i] = 0, sw[i] = -1;
int cc = tryCombination(st);
if (cc == -1)
{
memset(temp, 0, sizeof(temp));
for (int i = 0; i < n; i++)
{
temp[i] = 1;
cc = tryCombination(temp);
sw[i] = cc;
temp[i] = 0;
}
}
for (int i = 0; i < n; i++)
{
int cmb = tryCombination(st), swt = 1;
if (cmb == -1)
cmb = n;
if (cmb > i || cmb == -1)
swt = 0;
// st[i] = swt;
memset(temp, 1 - swt, sizeof(temp));
for (int j = 0; j < n; j++)
{
if (sw[j] != -1)
temp[j] = st[j];
}
for (int j = 0; j < n; j++)
{
if (sw[j] != -1)
continue;
temp[j] = swt;
cmb = tryCombination(temp);
if (cmb > i || cmb == -1)
{
sw[j] = i;
st[j] = swt;
break;
}
temp[j] = 1 - temp[j];
}
// for(int j=0;j<n;j++)
// cout << st[i] << " ";
// cout << '\n';
// for(int j=0;j<n;j++)
// cout << sw[i] << " ";
// cout << '\n';
}
answer(st, sw);
}
# | 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... |