Submission #670674

#TimeUsernameProblemLanguageResultExecution timeMemory
670674gustavo_dCave (IOI13_cave)C++17
25 / 100
32 ms436 KiB
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;

void exploreCave(int N) {
    int n = N;
    int confirmed[n];
    int test[n];
    int correspondence[n];
    for (int i = 0; i < n; i++) {
        test[i] = 0;
        correspondence[i] = i;
        confirmed[i] = -1;
    }
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    for (int i = 0; i<n; i++) {
        if (confirmed[i] != -1) test[i] = confirmed[i];
        else test[i] = 0;
    }
    if (tryCombination(test) == -1) {
        for (int to_try = 0; to_try<n; to_try++) {
            for (int i = 0; i<n; i++) {
                if (i == to_try) test[i] = 1;
                else test[i] = 0;
            }
            confirmed[to_try] = tryCombination(test);
        }
        for (int i = 0; i<n; i++) {
            test[i] = 0;
        }
        answer(test, confirmed);
    } else {
        for(int to_try = 0; to_try<n; to_try++) {
            int certo = 0;
            for (int i = 0; i<n; i++) {
                if (confirmed[i] != -1) test[i] = confirmed[i];
                else test[i] = 0;
            }
            if (tryCombination(test) == to_try) certo = 1;
            confirmed[to_try] = certo;
        }
        answer(confirmed, correspondence);
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...