제출 #548998

#제출 시각아이디문제언어결과실행 시간메모리
548998Leo121동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "cave.h" #define forn(i, a, b) for(int i = int(a); i <= int(b); ++ i) using namespace std; vector<int> nores; int n; int posiciones[lim]; int estado[lim]; void bs(int pos){ int li = 0, ls = n - pos - 1, mitad; int prueba[n + 1]; nores.clear(); forn(i, 0, n - 1){ arre[i] = (posiciones[i] == -1) ? 0 : estado[i]; if(posiciones[i] == -1){ nores.push_back(i); } } int aux = tryCombination(prueba); if(!ls){ posiciones[pos] = nores[ls]; estado[pos] = (aux == -1) ? 0 : 1; return; } bool saber = (aux == pos); while(li < ls){ mitad = (li + ls) / 2; forn(i, li, ls){ arre[nores[i]] = (i <= mitad) ? 1 : 0; } aux = tryCombination(prueba); if((saber && aux == pos) || (!saber && aux != pos)){ li = mitad + 1; } else{ ls = mitad; } } posiciones[pos] = nores[li]; estado[pos] = (int) saber; } void exploreCave(int N) { n = N; forn(i, 0, N - 1){ posiciones[i] = -1; estado[i] = 0; } forn(i, 0, N - 1){ bs(i); } int arreestado[N]; int arreposiciones[N]; forn(i, 0, N - 1){ arreestado[i] = estado[i]; arreposiciones[i] = posiciones[i]; } answer(arreestado, arreposiciones); }

컴파일 시 표준 에러 (stderr) 메시지

cave.cpp:10:16: error: 'lim' was not declared in this scope
   10 | int posiciones[lim];
      |                ^~~
cave.cpp:11:12: error: 'lim' was not declared in this scope
   11 | int estado[lim];
      |            ^~~
cave.cpp: In function 'void bs(int)':
cave.cpp:18:9: error: 'arre' was not declared in this scope
   18 |         arre[i] = (posiciones[i] == -1) ? 0 : estado[i];
      |         ^~~~
cave.cpp:18:20: error: 'posiciones' was not declared in this scope
   18 |         arre[i] = (posiciones[i] == -1) ? 0 : estado[i];
      |                    ^~~~~~~~~~
cave.cpp:18:47: error: 'estado' was not declared in this scope
   18 |         arre[i] = (posiciones[i] == -1) ? 0 : estado[i];
      |                                               ^~~~~~
cave.cpp:25:9: error: 'posiciones' was not declared in this scope
   25 |         posiciones[pos] = nores[ls];
      |         ^~~~~~~~~~
cave.cpp:26:9: error: 'estado' was not declared in this scope
   26 |         estado[pos] = (aux == -1) ? 0 : 1;
      |         ^~~~~~
cave.cpp:33:13: error: 'arre' was not declared in this scope
   33 |             arre[nores[i]] = (i <= mitad) ? 1 : 0;
      |             ^~~~
cave.cpp:43:5: error: 'posiciones' was not declared in this scope
   43 |     posiciones[pos] = nores[li];
      |     ^~~~~~~~~~
cave.cpp:44:5: error: 'estado' was not declared in this scope
   44 |     estado[pos] = (int) saber;
      |     ^~~~~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:50:9: error: 'posiciones' was not declared in this scope
   50 |         posiciones[i] = -1;
      |         ^~~~~~~~~~
cave.cpp:51:9: error: 'estado' was not declared in this scope
   51 |         estado[i] = 0;
      |         ^~~~~~
cave.cpp:59:25: error: 'estado' was not declared in this scope; did you mean 'arreestado'?
   59 |         arreestado[i] = estado[i];
      |                         ^~~~~~
      |                         arreestado
cave.cpp:60:29: error: 'posiciones' was not declared in this scope; did you mean 'arreposiciones'?
   60 |         arreposiciones[i] = posiciones[i];
      |                             ^~~~~~~~~~
      |                             arreposiciones