# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
390858 | jampm | Cave (IOI13_cave) | C++17 | 0 ms | 0 KiB |
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"
// Main
// int tryCombination(int N, int S[])
// void answer(int N, int S[], int D[])
//Sub-Tarea 5 (?)
void exploreCave(int N) {
int S[N], D[N]; int last = 0; bool vis[N];
for (int i = 0; i < N; i++) {
S[i] = 0; vis[i] = false;
}
while (last != -1) {
last = tryCombination(N, S);
for (int i = 0; i < N; i++) {
if (vis[i]) continue;
S[i] = (S[i] - 1)*(S[i] - 1);
int aux = tryCombination(N, S);
if (aux > last || aux == -1) {
last = aux;
break;
}
if (aux < last) vis[i] = false;
S[i] = (S[i] - 1)*(S[i] - 1);
}
}
for (int i = 0; i < N; i++) {
S[i] = (S[i] - 1)*(S[i] - 1);
D[i] = tryCombination(N,S);
S[i] = (S[i] - 1)*(S[i] - 1);
}
answer(N, S, D);
}