제출 #896469

#제출 시각아이디문제언어결과실행 시간메모리
896469sysia동굴 (IOI13_cave)C++17
0 / 100
160 ms500 KiB
//Sylwia Sapkowska #pragma GCC optimize("O3", "unroll-loops") #include <bits/stdc++.h> #include "cave.h" using namespace std; void exploreCave(int n) { vector<bool>fixed(n); int s[n], where[n]; for (int i = 0; i<n; i++) s[i] = 0; for (int i = 1; i<=n; i++){ int l = 0, r = n-1; int ans = 1; int curr = tryCombination(s); while (r >= l){ int mid = (l+r)/2; auto t = s; for (int j = 0; j<=mid; j++){ if (!fixed[j]){ t[j] = 1; } } int get = tryCombination(t); if (get == -1) get = n; if ((curr < i && get >= i) || (curr >= i && get < i)){ ans = mid; r = mid-1; } else { l = mid+1; } } fixed[ans] = 1; where[i] = ans; s[ans] = (curr >= i ? 0 : 1); } answer(s, where); }
#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...