Submission #672626

#TimeUsernameProblemLanguageResultExecution timeMemory
672626paulo_arCave (IOI13_cave)C++14
Compilation error
0 ms0 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; while(izq<=der){ mitad=(izq+der)/2; if(esuno)master=0; else master=1; int k=0; while(indice<mitad)){ if(activos[k]) { s[k]=res[k]; } else{ s[k]=master; inde++; } 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; inde++; } 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:24:17: error: 'indice' was not declared in this scope; did you mean 'inde'?
   24 |           while(indice<mitad)){
      |                 ^~~~~~
      |                 inde
cave.cpp:24:30: error: expected primary-expression before ')' token
   24 |           while(indice<mitad)){
      |                              ^
cave.cpp:39:26: error: 'indice' was not declared in this scope; did you mean 'inde'?
   39 |                    while(indice<cont && k<=n-1)){
      |                          ^~~~~~
      |                          inde
cave.cpp:39:48: error: expected primary-expression before ')' token
   39 |                    while(indice<cont && k<=n-1)){
      |                                                ^
cave.cpp:16:5: warning: unused variable 'contar' [-Wunused-variable]
   16 | int contar = 0;
      |     ^~~~~~