제출 #116935

#제출 시각아이디문제언어결과실행 시간메모리
116935dragonslayerit동굴 (IOI13_cave)C++14
100 / 100
902 ms516 KiB
#include "cave.h" int combo[5005]; int base[5005]; int door[5005]; int n; bool check(int len,int target){ for(int i=0;i<n;i++){ combo[i]=base[i]; if(i<len&&door[i]==-1){ combo[i]^=1; } } return tryCombination(combo)!=target; } void exploreCave(int N) { n=N; for(int i=0;i<N;i++){ door[i]=-1; } for(int i=0;i<N;i++){ if(tryCombination(base)!=i){ for(int j=0;j<N;j++){ if(door[j]==-1){ base[j]^=1; } } } int low=0,high=N; while(high-low>1){ int mid=(low+high)/2; if(check(mid,i)){ high=mid; }else{ low=mid; } } door[low]=i; base[low]^=1; } answer(base,door); }
#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...