제출 #425415

#제출 시각아이디문제언어결과실행 시간메모리
425415frodakcin동굴 (IOI13_cave)C++17
100 / 100
258 ms452 KiB
#include "cave.h" #include <cstring> #include <vector> #include <numeric> #include <cassert> void exploreCave(int N) { int S[N], D[N]; // vla legal ? memset(S, 0, sizeof S); std::vector<int> cand(N); std::iota(cand.begin(), cand.end(), 0); for(int i=0;i<N;++i) { int v = tryCombination(S); assert(v == -1 || v >= i); bool down = v==i; int l=0, r=cand.size(); for(;r-l>1;) { int m=l+(r-l)/2; for(int j=l;j<m;++j) S[cand[j]]^=1; v = tryCombination(S); assert(v == -1 || v >= i); for(int j=l;j<m;++j) S[cand[j]]^=1; if((v==i) == down) l=m; else r=m; } if(down) S[cand[l]] ^= 1; D[cand[l]]=i; cand.erase(cand.begin()+l); } 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...