Submission #569460

#TimeUsernameProblemLanguageResultExecution timeMemory
569460penguin133Cave (IOI13_cave)C++14
100 / 100
332 ms592 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; void exploreCave(int N) { int ans[N], D[N]; int vis[N] = {0}; for(int i=0;i<N;i++){ ans[i] = 0; } for(int i=0;i<N;i++){ int ans2[N]; for(int j=0;j<N;j++)ans2[j] = ans[j]; int sg =0 ; int y = tryCombination(ans2); if(y <= i && y != -1)sg = 1; for(int j=0;j<N;j++)if(!vis[j])ans2[j] = 1 - sg; int s = 0, e = N - 1; while(s < e){ int m = (s + e)/2; int ans3[N]; for(int j=0;j<N;j++)ans3[j] = ans2[j]; for(int j=s;j<=m;j++)if(!vis[j])ans3[j] = sg; int x = tryCombination(ans3); if(x > i || x == -1)e = m; else s = m + 1; } vis[s] = true; D[s] = i; ans[s] = sg; } answer(ans, 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...