제출 #884105

#제출 시각아이디문제언어결과실행 시간메모리
884105AndrijaM동굴 (IOI13_cave)C++14
0 / 100
136 ms504 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; const int maxn = 2e5+10; void exploreCave(int n) { int d[n]; memset(d,-1,sizeof d); int s[n]; memset(s,0,sizeof s); bool vis[n]; memset(vis,0,sizeof vis); for(int i=0;i<n;i++) { for(int idx=0;idx<n;idx++) { if(vis[idx]==true)continue; s[idx]=0; } int lastd=tryCombination(s); int tip=0; if(lastd==-1 || lastd>i+1) { tip=1; } int l=0; int r=n-1; while(l<r) { int mid=l+(r-l)/2; for(int idx=0;idx<=mid;idx++) { if(vis[idx]==true)continue; s[idx]=tip; } if(tip==1) { if(tryCombination(s)>i+1) { l=mid+1; } else { r=mid; } } else { if(tryCombination(s)<=i+1) { l=mid+1; } else { r=mid; } } } vis[l]=true; s[l]=(tip+1)%2; d[i]=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...