Submission #425413

#TimeUsernameProblemLanguageResultExecution timeMemory
425413frodakcinCave (IOI13_cave)C++17
13 / 100
246 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); for(int j=l;j<m;++j) S[cand[j]]^=1; if((v==i) == down) l=m; else r=m; } 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...