제출 #543696

#제출 시각아이디문제언어결과실행 시간메모리
543696nayhz동굴 (IOI13_cave)C++17
100 / 100
245 ms536 KiB
#include "cave.h" #include <bits/stdc++.h> #define ll long long using namespace std; int s[5005]; // switch int ans[5005]; void exploreCave(int n) { memset(ans, -1, sizeof(ans)); ll l, r, mid; bool flag, idk; for (int i = 0; i < n; i++) { l = 0, r = n - 1; flag = (tryCombination(s) == i); while (l <= r) { mid = (l + r) / 2; for (int j = l; j <= mid; j++) if (ans[j] == -1) s[j] = 1; idk = (tryCombination(s) == i); for (int j = l; j <= mid; j++) if (ans[j] == -1) s[j] = 0; if (flag == idk) l = mid + 1; else r = mid - 1; } ans[l] = i, s[l] = flag; } answer(s, ans); }
#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...