Submission #314786

#TimeUsernameProblemLanguageResultExecution timeMemory
314786shafinalamCave (IOI13_cave)C++14
0 / 100
645 ms760 KiB
#include "cave.h" void exploreCave(int N) { int s[N], d[N]; int vis[N] = {0}; for(int i = 0; i < N; i++) { if(vis[i]) continue; int cur = 0; int got = -1; int tmp[N]; for(int i = 0; i < N; i++) { if(vis[i]) tmp[i] = s[i]; else tmp[i] = cur; } int p = tryCombination(tmp); if(p>=i) cur = 0; else cur = 1; for(int i = 0; i < N; i++) { if(vis[i]) tmp[i] = s[i]; else tmp[i] = cur; } int lo = 0, hi = N-1; while(lo<=hi) { int mid = (lo+hi)>>1; for(int r = 0; r < N; r++) { if(r>=lo && r<=mid) continue; if(vis[r]) continue; tmp[r] = 1-cur; } p = tryCombination(tmp); if(p>=i) { got = mid; hi = mid-1; } else { for(int j = lo; j <= mid; j++) tmp[j] = 1-cur; for(int j = mid+1; j <= hi; j++) tmp[j] = cur; lo = mid+1; } } s[i] = cur; d[i] = got; } 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...