제출 #410802

#제출 시각아이디문제언어결과실행 시간메모리
410802AlexRex0동굴 (IOI13_cave)C++14
0 / 100
84 ms348 KiB
#include "cave.h" #include<bits/stdc++.h> using namespace std; bool visitado[5002]; int posiciones[5002]; int S[5002]; int prueba(int ini, int n){ for(int i = 0; i < n; ++i){ if(!visitado[i]){ S[i] = 0; } } if(tryCombination(S) >= ini){ return 1; } return 2; } void bs(int tipo, int busco, int fin){ int medio, ini = 0, res = -1; fin--; for(int i = 0; i <= fin; ++i){ if(!visitado[i]){ if(tipo == 2){ S[i] = 1; }else{ S[i] = 0; } } } while(ini <= fin){ medio = (ini + fin) / 2; for(int i = medio + 1; i <= fin; ++i){ if(!visitado[i]){ if(tipo == 1){ S[i] = 1; }else{ S[i] = 0; } } } if(tryCombination(S) >= busco){ res = medio; fin = medio - 1; }else{ for(int i = ini; i <= medio; ++i){ if(!visitado[i]){ if(tipo == 1){ S[i] = 0; }else{ S[i] = 1; } } } ini = medio + 1; } } visitado[res] = true; if(tipo == 1){ S[res] = 0; }else{ S[res] = 1; } posiciones[res] = busco; } void exploreCave(int N) { for(int i = 0; i < N; ++i){ int aux = prueba(i, N); bs(aux, i, N); } answer(S, posiciones); }
#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...