제출 #468028

#제출 시각아이디문제언어결과실행 시간메모리
468028SirCovidThe19thCave (IOI13_cave)C++17
100 / 100
1083 ms452 KiB
#include <bits/stdc++.h>
#include "cave.h"
using namespace std; 

#define FOR(i, x, y) for (int i = x; i < y; i++)

void exploreCave(int n){
    int door[n], move[n], use[n] = {};
    FOR(i, 0, n){
        int openI, L = 0, H = n - 1;
        FOR(j, 0, n) if (!use[j]) move[j] = 0;
        openI = (tryCombination(move) == i);
        while (L < H){
            int M = (L + H) / 2;
            FOR(j, 0, n) if (!use[j]) move[j] = openI ^ (j >= L and j <= M);
            (tryCombination(move) == i) ? (H = M) : (L = M + 1);
        }
        door[L] = i; move[L] = openI; use[L] = 1;
    }
    answer(move, door);
}
#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...