Submission #672627

#TimeUsernameProblemLanguageResultExecution timeMemory
672627paulo_arCave (IOI13_cave)C++14
0 / 100
127 ms416 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; int s [5004]; int res [5004]; bool activos [5004]; int ans [5004]; int busqueda (bool esuno, int inde, int n, int cont){ int izq= 1, der=cont; int mitad; int rep=0; int master; int contar = 0; int indice; while(izq<=der){ mitad=(izq+der)/2; indice=0; if(esuno)master=0; else master=1; int k=0; while(indice<mitad){ if(activos[k]) { s[k]=res[k]; } else{ s[k]=master; indice++; } k++; } if(esuno)master=1; else master=0; while(indice<cont && k<=n-1){ if(activos[k]) { s[k]=res[k]; } else{ s[k]=master; indice++; } k++; } int p = tryCombination(s); if(p>=inde or p==-1){ der=mitad-1; rep=mitad; } else { izq=mitad+1; } } return rep; } void exploreCave(int N) { int ll; for(int i=0; i<N; i++){ res[i]=false; } for(int j=1; j<=N; j++){ int master=1; for(int i=0; i<N; i++){ if(activos[i]){ s[i]=res[i]; } else{ s[i]=master; } } ll=tryCombination(s); int des; int a; int cont = N-j+1; if(ll>=j or ll==-1){ des= busqueda(true,j,N,cont); a=1; } else { des=busqueda(false,j,N,cont); a=0; } activos [des]=true; res[des]=a; ans[des]=j-1; } answer(res, ans); // int tryCombination(int S[]); //void answer(int S[], int D[]); //void exploreCave(int N); }

Compilation message (stderr)

cave.cpp: In function 'int busqueda(bool, int, int, int)':
cave.cpp:16:5: warning: unused variable 'contar' [-Wunused-variable]
   16 | int contar = 0;
      |     ^~~~~~
#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...