Submission #571996

#TimeUsernameProblemLanguageResultExecution timeMemory
571996VanillaCave (IOI13_cave)C++17
0 / 100
77 ms480 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; void exploreCave(int n) { int s[n], dr[n]; if (n == 1) { s[0] = dr[0] = 0; if (tryCombination(s) != -1) { s[0] = 1; } answer(s, dr); return; } for (int i = 0; i < n; i++){ s[i] = 0, dr[i] = -1; } for (int door = 0; door < n; door++){ for (int i = 0; i < n; i++){ if (dr[i] == -1) { s[i] = 0; } } int l = 0, r = n-1, state = 1, k = tryCombination(s); int rs = 0; while (l <= r) { for (int i = l; i <= r; i++){ if (dr[i] == -1) s[i] = 0; } int mid = (l + r) / 2; for (int i = l; i <= mid; i++){ if (dr[i] == -1) dr[i] = 1; } k = tryCombination(s); if(k == door) { r = mid - 1; rs = mid; state = !state; }else { l = mid + 1; } } dr[rs] = door; s[rs] = state; } answer(s, dr); }
#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...