제출 #514194

#제출 시각아이디문제언어결과실행 시간메모리
514194thegrimbee동굴 (IOI13_cave)C++14
0 / 100
29 ms460 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; void exploreCave(int N) { int S[N], D[N], visited[N], ans[N], temp[N]; int lo, hi, mid, cur; for (int i = 1; i <= N; ++i){ lo = 0;hi = N;mid = (lo + hi)/2; copy(ans, ans + N, temp); if (tryCombination(temp) == i)cur = 0; else cur = 1; while (lo != mid){ if (cur){ for (int i = lo; i < mid; ++i){ if (!visited[i])temp[i] = 1; } } else{ for (int i = mid; i < hi; ++i){ if (!visited[i])temp[i] = 1; } } if (tryCombination(temp) == i)hi=mid; else lo = mid; mid = (lo + hi)/2; } visited[mid] = 1; ans[mid] = cur; S[i-1] = cur; D[i-1] = mid; } answer(S, D); }
#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...