Submission #7528

#TimeUsernameProblemLanguageResultExecution timeMemory
7528baneling100Cave (IOI13_cave)C++98
100 / 100
440 ms640 KiB
#include "cave.h" #include <vector> using namespace std; vector <int> A; int S[5000], D[5000], Check[5000]; void exploreCave(int N) { int i, j, Left, Mid, Right, Value, Temp; for(i=0 ; i<N ; i++) { A.clear(); for(j=0 ; j<N ; j++) if(!Check[j]) A.push_back(j); Left=0; Right=A.size()-1; Value=tryCombination(S); while(Left<Right) { Mid=(Left+Right)/2; for(j=Left ; j<=Mid ; j++) S[A[j]]=1-S[A[j]]; Temp=tryCombination(S); for(j=Left ; j<=Mid ; j++) S[A[j]]=1-S[A[j]]; if(Value==i) { if(Temp>i || Temp==-1) Right=Mid; else Left=Mid+1; } else { if(Temp==i) Right=Mid; else Left=Mid+1; } } if(Value==i) S[A[Left]]=1-S[A[Left]]; D[A[Left]]=i; Check[A[Left]]=1; } 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...