Submission #759697

#TimeUsernameProblemLanguageResultExecution timeMemory
759697AndreyCave (IOI13_cave)C++14
0 / 100
396 ms392 KiB
#include "cave.h" #include<bits/stdc++.h> using namespace std; void exploreCave(int n) { int ans[n]; int sw[n]; int idk[n]; for(int i = 0; i < n; i++) { sw[i] = -1; } int l,r,m,x; for(int i = 0; i < n; i++) { l = 0; r = n-1; for(int j = 0; j < n; j++) { idk[j] = sw[j]; } x = tryCombination(idk); while(l < r) { m = (l+r)/2; for(int j = 0; j < n; j++) { if(sw[j] != -1) { idk[j] = sw[j]; } else { if(j >= l && j <= m && sw[i] != -1) { idk[j] = 1; } else { idk[j] = 0; } } } if((tryCombination(idk) == i) != (x == i)) { r = m; } else { l = m+1; } } ans[i] = l; if(x == -1 || x > i) { sw[l] = 0; } else { sw[l] = 1; } } answer(sw,ans); }
#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...