Submission #884173

#TimeUsernameProblemLanguageResultExecution timeMemory
884173AndrijaMCave (IOI13_cave)C++14
12 / 100
374 ms596 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; const int maxn = 2e5+10; void exploreCave(int n) { int d[n]; int s[n]; bool vis[n]; memset(d,-1,sizeof d); memset(vis,0,sizeof vis); memset(s,0,sizeof s); for(int idx=0;idx<n;idx++) { for(int i=0;i<n;i++) { if(vis[i])continue; s[i]=0; } int p=tryCombination(s); int tip=-1; if(p==idx) { tip=1; } else { tip=0; } int l=0; int r=n-1; while(true) { int mid=(r+l)/2; if(tip==1) { for(int i=0;i<n;i++) { if(vis[i])continue; s[i]=0; } for(int i=l;i<=mid;i++) { if(vis[i])continue; s[i]=1; } } else { for(int i=0;i<n;i++) { if(vis[i])continue; s[i]=1; } for(int i=l;i<=mid;i++) { if(vis[i])continue; s[i]=0; } } int poz=tryCombination(s); if(poz==idx) { l=mid+1; } else { r=mid; } if(l==r)break; } d[idx]=l; s[l]=tip; vis[l]=true; } 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...