Submission #884163

#TimeUsernameProblemLanguageResultExecution timeMemory
884163AndrijaMCave (IOI13_cave)C++14
12 / 100
407 ms548 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(vis,0,sizeof vis); memset(s,0,sizeof s); int idx=0; while(idx<n) { for(int i=0;i<n;i++) { if(vis[i])continue; s[i]=0; } int p=tryCombination(s); int tip; if(p==idx) { tip=1; } else { tip=0; } int l=0; int r=n-1; while(l<r) { int mid=l+(r-l)/2; if(tip==1) { for(int i=0;i<n;i++) { if(vis[i])continue; s[i]=0; } for(int i=0;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=0;i<=mid;i++) { if(vis[i])continue; s[i]=0; } } int poz=tryCombination(s); if(poz==idx) { l=mid+1; } else { r=mid; } } d[idx]=l; s[l]=tip; vis[l]=true; idx++; } 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...