제출 #807100

#제출 시각아이디문제언어결과실행 시간메모리
807100wortelworm동굴 (IOI13_cave)C++17
100 / 100
655 ms460 KiB
#include <bits/stdc++.h> #include "cave.h" // #include "grader.c" using namespace std; void exploreCave(int N) { vector<bool> do_not_change(N); int answers[N] = {}; int state[N] = {}; for (int door = 0; door < N; door++) { int lever_number = 0; // either (true -> open) or (false -> open) bool open_state; for (int i = 0; i < N; i++) { if (do_not_change[i]) { continue; } state[i] = true; } { int dist = tryCombination(state); open_state = (dist == -1) || dist > door; } // loop over every bit in the number of the levers for (int i = 4096; i > 0; i /= 2) { // for (int i = 2; i > 0; i /= 2) { // set the levers like this for (int j = 0; j < N; j++) { if (do_not_change[j]) { continue; } state[j] = (((j & i) == 0) xor (open_state)) ? 1 : 0; } int dist = tryCombination(state); if (dist == -1 || dist > door) { // success lever_number += i; } } answers[lever_number] = door; state[lever_number] = open_state; do_not_change[lever_number] = true; } answer(state, answers); }
#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...