Submission #556138

#TimeUsernameProblemLanguageResultExecution timeMemory
556138n0sk1llCave (IOI13_cave)C++14
0 / 100
498 ms400 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 inv) { int c[n]; for (int i=0;i<l;i++) c[i]=inv; for (int i=l;i<=r;i++) c[i]=!inv; for (int i=r+1;i<n;i++) c[i]=inv; 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 inv=0; int l=0,r=n-1; if (probaj(l,r,inv)==i) inv=1; while (l!=r) { int mid=(l+r)/2; if (probaj(l,mid,inv)==i) l=mid+1; else r=mid; } vis[l]=1; sta[l]=!inv; d[l]=i,s[l]=1; } 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...