Submission #757221

#TimeUsernameProblemLanguageResultExecution timeMemory
757221KALARRYCave (IOI13_cave)C++14
0 / 100
1 ms340 KiB
//chockolateman #include "cave.h" #include<bits/stdc++.h> using namespace std; void exploreCave(int N) { int seq[N+5]; int ans[N+5]; for(int i =0 ; i < N ; i++) seq[i] = 0; bool used[N+5]; for(int i = 0 ; i < N ; i++) used[i] = false; for(int i = 0 ; i < N ; i++) { int res = tryCombination(seq); if(res>i||res==-1) { for(int i = 0 ; i < N ; i++) if(!used[i]) { if(seq[i]) seq[i] = 0; else seq[i] = 1; } } int low = 0; int high = N-1; while(high > low) { int mid = (low+high)/2; for(int i = 0 ; i <= mid; i++) { if(seq[i]) seq[i] = 0; else seq[i] = 1; } res = tryCombination(seq); if(res>i||res==-1) high = mid; else low = mid; for(int i = 0 ; i <= mid; i++) { if(seq[i]) seq[i] = 0; else seq[i] = 1; } } if(seq[low]) seq[low] = 0; else seq[low] = 1; used[low] = true; ans[i] = low; answer(seq,ans); } }
#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...