# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
261551 | c4ts0up | 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.
void exploreCave(int n) {
// disposicion final
for (int i=0; i<n; i++) S[i] = 0;
int puerta, res;
while (puerta != -1) {
/*//
std::cerr << "S: ";
for (int i=0; i<n; i++) std::cerr << S[i] << " ";
std::cerr << std::endl;
//*/
puerta = tryCombination(S);
//std::cerr << "Puerta = " << puerta << std::endl;
if (puerta == -1) break;
for (int i=0; i<n; i++) {
S[i] = 1;
res = tryCombination(S);
//std::cerr << "res = " << res << std::endl;
if (res <= puerta && res != -1) S[i] = 0;
else break;
}
}
// ya tenemos la combinacion correcta, ahora a identificar las puertas
for (int i=0; i<n; i++) {
S[i] = (S[i] == 0 ? 1 : 0);
puerta = tryCombination(S);
D[i] = puerta;
S[i] = (S[i] == 0 ? 1 : 0);
}
answer(S, D);
}