Submission #569597

#TimeUsernameProblemLanguageResultExecution timeMemory
569597Aurora2005Cave (IOI13_cave)C++14
0 / 100
391 ms448 KiB
#include<bits/stdc++.h> #include"cave.h" using namespace std; void exploreCave(int N){ vector<pair<int,int>> ans(N); for(int i=0;i<N;i++) ans[i] = make_pair(-1,-1); for(int i=0;i<N;i++){ int First[N]; for(int j=0;j<N;j++){ if(ans[j].first == -1) First[j] = 0; else First[j] = ans[j].second; } if(tryCombination(First) == i+1){ int l = 0,r = N; while(r-l > 1){ int m = (l+r)/2; int S[N]; for(int j=0;j<N;j++){ if(ans[j].first == -1){ if(j < m) S[j] = 0; else S[j] = 1; } else S[j] = ans[j].second; } if(tryCombination(S) == i+1) r = m; else l = m; } ans[l].first = i; ans[l].second = 1; } else{ int l = 0,r = N; while(r-l > 1){ int m = (l+r)/2; int S[N]; for(int j=0;j<N;j++){ if(ans[j].first == -1){ if(j < m) S[j] = 0; else S[j] = 1; } else S[j] = ans[j].second; } if(tryCombination(S) == i+1) l = m; else r = m; } ans[l].first = i; ans[l].second = 0; } } int ansS[N]; int ansD[N]; for(int i=0;i<N;i++){ ansS[i] = ans[i].second; ansD[i] = ans[i].first; } answer(ansS,ansD); }
#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...