Submission #681854

#TimeUsernameProblemLanguageResultExecution timeMemory
681854paulo_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=-1; int master; int cf; int contar = 0; int indice; if(esuno)master=0,cf=1; else master=1,cf=0; while(izq<=der){ mitad=(izq+der)/2; indice=0; int k=0; while(k<N){ if(activos[k]) { s[k]=res[k]; } else if(indice<mitad){ s[k]=master; indice++; } else{ s[k]=cf; } 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 des; int a; int cont; int ll; for(int i=0; i<N; i++){ res[i]=0; activos[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); 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:25:19: error: 'N' was not declared in this scope
   25 |           while(k<N){
      |                   ^
cave.cpp:17:5: warning: unused variable 'contar' [-Wunused-variable]
   17 | int contar = 0;
      |     ^~~~~~