제출 #237351

#제출 시각아이디문제언어결과실행 시간메모리
237351jam_xd_동굴 (IOI13_cave)C++17
0 / 100
2093 ms512 KiB
#include "cave.h" #include "bits/stdc++.h" using namespace std; void exploreCave(int N) { int ggnomas[N]={}, S[N] = {};//inician en 0 int D[N]; for(int i=0;i<N;i++){ // crear el array del si switchs estan encendidos o apagados int prb[N]; for(int j=0;j<N;j++){ if(ggnomas[j] != 0) prb[j] = S[j]; else prb[j] = 1; } int uwu = tryCombination(prb); int afirmo = 1; if(uwu<=i and uwu!=-1) afirmo = 0; // Posicion del switch q quiero int minimo=0, maximo= N-1; int medio; //binary search del stack adaptado xd xd while(minimo <= maximo){ medio = (minimo + maximo)/2; for(int j=0;j <= medio;i++){ if(ggnomas[j] != 0) prb[j] = S[j]; else prb[j] = afirmo; } for(int k= medio+1;k< N;k++){ if(ggnomas[k] != 0) prb[k] = S[k]; else prb[k] = 1 - afirmo; } uwu = tryCombination(prb); if(uwu > i or uwu== -1){ maximo = medio-1; } else { medio++; minimo = medio; } } ggnomas[medio] = 1; S[medio] = afirmo; D[medio] = i; } 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...