Submission #556146

#TimeUsernameProblemLanguageResultExecution timeMemory
556146n0sk1llCave (IOI13_cave)C++14
25 / 100
935 ms408 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; int n; bool vis[5005]; bool sta[5005]; int probaj(int l, int r, bool dobar) { int c[n]; for (int i=0;i<l;i++) c[i]=!dobar; for (int i=l;i<=r;i++) c[i]=dobar; for (int i=r+1;i<n;i++) c[i]=!dobar; for (int i=0;i<n;i++) if (vis[i]) c[i]=sta[i]; return tryCombination(c); } void exploreCave(int N) { n=N; int s[n],d[n]; for (int i=0;i<n;i++) { bool dobar=1; int l=0,r=n-1; if (probaj(l,r,dobar)==i) dobar=0; while (l!=r) { int mid=(l+r)/2; if (probaj(l,mid,dobar)==i) l=mid+1; else r=mid; } vis[l]=1; sta[l]=dobar; d[l]=i,s[l]=sta[i]; } 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...