Submission #410800

#TimeUsernameProblemLanguageResultExecution timeMemory
410800AlexRex0Cave (IOI13_cave)C++14
Compilation error
0 ms0 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); }

Compilation message (stderr)

cave.cpp:3:20: error: expected ';' before ':' token
    3 | using namespace std:
      |                    ^
      |                    ;
cave.cpp:3:20: error: expected unqualified-id before ':' token
cave.cpp: In function 'int prueba(int, int)':
cave.cpp:11:13: error: 'visitado' was not declared in this scope
   11 |         if(!visitado[i]){
      |             ^~~~~~~~
cave.cpp: In function 'void bs(int, int, int)':
cave.cpp:25:13: error: 'visitado' was not declared in this scope
   25 |         if(!visitado[i]){
      |             ^~~~~~~~
cave.cpp:36:17: error: 'visitado' was not declared in this scope
   36 |             if(!visitado[i]){
      |                 ^~~~~~~~
cave.cpp:49:21: error: 'visitado' was not declared in this scope
   49 |                 if(!visitado[i]){
      |                     ^~~~~~~~
cave.cpp:60:5: error: 'visitado' was not declared in this scope
   60 |     visitado[res] = true;
      |     ^~~~~~~~