Submission #927287

#TimeUsernameProblemLanguageResultExecution timeMemory
927287Art_ogoCave (IOI13_cave)C++17
100 / 100
282 ms788 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; const int MAXN = 5010; int S[MAXN]; int D[MAXN]; bool ok[MAXN]; void exploreCave(int N) { for(int i = 0; i < N; i++){ for(int j = 0; j < N; j++) if(!ok[j]) S[j] = 0; int ans = tryCombination(S); if(ans == i) for(int j = 0; j < N; j++) if(!ok[j]) S[j] = 1; int l = 0, r = N - 1; while(l < r){ int mid = (l + r) >> 1; for(int j = l; j <= mid; j++) if(!ok[j]) S[j] = 1 - S[j]; ans = tryCombination(S); for(int j = l; j <= mid; j++) if(!ok[j]) S[j] = 1 - S[j]; if(ans == i) r = mid; else l = mid + 1; } ok[l] = 1; D[l] = i; // cout << l << endl; } 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...