제출 #425412

#제출 시각아이디문제언어결과실행 시간메모리
425412frodakcin동굴 (IOI13_cave)C++17
0 / 100
212 ms588 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); if((v==i) == down) l=m; else r=m; for(int j=l;j<m;++j) S[cand[j]]^=1; } if(down) S[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...