Submission #777248

#TimeUsernameProblemLanguageResultExecution timeMemory
777248JoenPoenManCave (IOI13_cave)C++17
100 / 100
1738 ms560 KiB
#include "cave.h"
#include <bits/stdc++.h>

using namespace std;



void exploreCave(int N) {
    int D[N];
    int CS[N];
    bool found[N]{};
    for (int doorN = 0; doorN < N; doorN++) {
        int res = 0;
        int S[N]{};
        for (int n = 0; n < N; n++) if (found[n]) S[n] = CS[n];
        bool type = (tryCombination(S) == doorN); 
        for (int i = 1; i < N; i *= 2) {
            int S[N];
            for (int n = 0; n < N; n++) {
                S[n] = (n%(2*i) < i ? 0 : 1);
                if (found[n]) S[n] = CS[n];
            }

            if ((type && tryCombination(S) != doorN) || (!type && tryCombination(S) == doorN)) res += i;
        }
        D[res] = doorN;
        found[res] = true;
        CS[res] = type;
    }
    answer(CS, D);
}
#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...