제출 #720212

#제출 시각아이디문제언어결과실행 시간메모리
720212Yell0동굴 (IOI13_cave)C++17
100 / 100
682 ms588 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; void exploreCave(int N) { int config[N],perm[N]; vector<int> idx; for(int i=0;i<N;++i) idx.push_back(i); for(int i=0;i<N;++i) { int on=1; for(int x:idx) config[x]=1; if(tryCombination(config)==i) on=0; for(int x:idx) config[x]=!on; int lo=0,hi=N-i-1; while(lo<=hi) { int mid=(lo+hi)/2,j=0; for(int x:idx) { if(j>mid) break; if(j++<lo) continue; config[x]=on; } if(tryCombination(config)==i) lo=mid+1; else hi=mid-1; for(int x:idx) config[x]=!on; } config[idx[lo]]=on; perm[idx[lo]]=i; idx.erase(idx.begin()+lo); } answer(config,perm); }
#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...