Submission #807096

#TimeUsernameProblemLanguageResultExecution timeMemory
807096wortelwormCave (IOI13_cave)C++17
0 / 100
85 ms440 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...