제출 #197672

#제출 시각아이디문제언어결과실행 시간메모리
197672joylintp동굴 (IOI13_cave)C++17
100 / 100
1287 ms512 KiB
#include"cave.h" #include<bits/stdc++.h> using namespace std; void exploreCave(int n) { int sta[5000] = {}, dor[5000] = {}; for (int tar = 0; tar < n; tar++) { int ask[5000]; for (int i = 0; i < 5000; i++) if (sta[i]) ask[i] = sta[i] - 1; else ask[i] = 1; int ret = tryCombination(ask); bool suc; if (ret == -1 || ret > tar) suc = true; else suc = false; int l = 0, r = n - 1; while (l != r) { int m = (l + r) / 2; for (int i = 0; i < n; i++) if (sta[i]) ask[i] = sta[i] - 1; else if (l <= i && i <= m) ask[i] = suc; else ask[i] = !suc; ret = tryCombination(ask); if (ret == -1 || ret > tar) r = m; else l = m + 1; } sta[l] = suc + 1; dor[l] = tar; } for (int i = 0; i < n; i++) sta[i]--; answer(sta, dor); }
#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...