제출 #572003

#제출 시각아이디문제언어결과실행 시간메모리
572003Vanilla동굴 (IOI13_cave)C++17
0 / 100
187 ms404 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); while (l < r) { if(k != -1 && k <= door) for (int i = l; i <= r; i++){ if (dr[i] == -1) s[i] = !s[i]; } int mid = (l + r) / 2; for (int i = l; i <= mid; i++){ if (dr[i] == -1) s[i] = !s[i]; } k = tryCombination(s); state = s[l]; if(k == door) { r = mid; state ^=1; }else { l = mid + 1; } } dr[l] = door; s[l] = 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...