This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#ifndef NOTSUBMIT
#include <bits/stdc++.h>
#include "cave.h"
using namespace std;
#endif // NOTSUBMIT
void exploreCave(int N) {
int flp[5020] = {};
int dor[5020] = {};
bool chk[5020] = {};
if (tryCombination(flp) == -1){ // Subtask 2
for (int i = 0; i < N; i++){
flp[i] = 1;
int res = tryCombination(flp);
dor[i] = res;
flp[i] = 0;
}
answer(flp, dor);
}
if (N <= 100){ // Subtask 3
for (int i = 0; i < N; i++){
int p = N;
for (int j = 0; j < N; j++){
if (chk[j]){ continue; }
int res1 = tryCombination(flp);
flp[j] = 1;
int res2 = tryCombination(flp);
flp[j] = 0;
if (res1 == i && res2 != i){ p = j; break; }
if (res1 != i && res2 == i){ p = j; break; }
}
//cout << i << ' ' << p << endl;
dor[p] = i; chk[p] = 1;
int res1 = tryCombination(flp);
flp[p] = 1;
int res2 = tryCombination(flp);
flp[p] = 0;
if (res1 == i && res2 != i){ flp[p] = 1; }
if (res1 != i && res2 == i){ flp[p] = 0; }
}
answer(flp, dor);
}
// Subtask 1 (Not Considering Subtask 4, 5)
for (int i = 0; i < N; i++){ dor[i] = i; }
while (1){
int res = tryCombination(flp);
if (res == -1){ break; }
flp[res] = 1;
}
answer(flp, dor);
}
# | 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... |