제출 #670665

#제출 시각아이디문제언어결과실행 시간메모리
670665gustavo_d동굴 (IOI13_cave)C++17
0 / 100
2 ms340 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; void exploreCave(int N) { int n = N; int confirmed[n]; int test[n]; int correspondence[n]; for (int i = 0; i < n; i++) { test[i] = 0; confirmed[i] = -1; } ios_base::sync_with_stdio(false); cin.tie(NULL); for(int to_try = 0; to_try<n; to_try++) { int l = 0; int r = n-1; int certo = 0; for (int i = 0; i<r; i++) { if (confirmed[i] != -1) test[i] = confirmed[i]; else test[i] = 0; } if (tryCombination(test) == to_try) certo = 1; while (l != r) { int mid = (l+r) / 2; for (int i = 0; i<r; i++) { if (confirmed[i] != -1) test[i] = confirmed[i]; else { if (i >= l && i < mid + l) test[i] = certo; else test[i] = !certo; } } int tried = tryCombination(test); if (to_try != tried) { r = mid - 1; } else { l = mid; } } confirmed[l] = certo; correspondence[l] = to_try; } answer(confirmed, correspondence); }
#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...