제출 #672605

#제출 시각아이디문제언어결과실행 시간메모리
672605paulo_ar동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; int s [5004]; int res [5004]; bool activos [5004]; vector ans; int busqueda (bool esuno, int inde, int n){ int izq=1, int der=n; int mitad; int master; while(izq<=der){ mitad=(izq+der)/2; if(esuno)master=0; else master=1; for(int i=1; i<=mitad; i++){ if(res[i]){ s[i]=res[i]; } else{ s[i]=master; } } if(esuno)master=1; else master=0; for(int i=mitad+1; i<=n; i++){ if(res[i]){ s[i]=res[i]; } else{ s[i]=master; } } if(tryCombination(s[])>=inde){ der=mitad-1; } else { izq=mitad+1; } } return mitad; } void exploreCave(int N) { string s = ""; int ll; for(int i=1; i<=n; i++){ res[i]=false; } for(int j=1; j<=n; j++){ for(int i=1; i<=n; i++){ if(res[i]){ s[i]=res[i]; } else{ s[i]=master; } } ll=tryCombination(s[]); int des; int a; if(ll>=i){ des= busqueda(true,i,N): a=1; } else { des=busqueda(false,i,N); a=0; } activos [des]=true; res[der]=a; ans.push_back(des); } answer(s[], ans[]); // int tryCombination(int S[]); //void answer(int S[], int D[]); //void exploreCave(int N); }

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

cave.cpp:8:1: error: invalid use of template-name 'std::vector' without an argument list
    8 | vector ans;
      | ^~~~~~
cave.cpp:8:1: note: class template argument deduction is only available with '-std=c++17' or '-std=gnu++17'
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from cave.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note: 'template<class _Tp, class _Alloc> class std::vector' declared here
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
cave.cpp: In function 'int busqueda(bool, int, int)':
cave.cpp:11:16: error: expected unqualified-id before 'int'
   11 |     int izq=1, int der=n;
      |                ^~~
cave.cpp:14:16: error: 'der' was not declared in this scope
   14 |     while(izq<=der){
      |                ^~~
cave.cpp:39:30: error: expected primary-expression before ']' token
   39 |          if(tryCombination(s[])>=inde){
      |                              ^
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:53:21: error: 'n' was not declared in this scope
   53 |     for(int i=1; i<=n; i++){
      |                     ^
cave.cpp:57:20: error: 'n' was not declared in this scope
   57 |    for(int j=1; j<=n; j++){
      |                    ^
cave.cpp:64:18: error: 'master' was not declared in this scope
   64 |             s[i]=master;
      |                  ^~~~~~
cave.cpp:67:24: error: expected primary-expression before ']' token
   67 |    ll=tryCombination(s[]);
      |                        ^
cave.cpp:70:11: error: 'i' was not declared in this scope
   70 |    if(ll>=i){
      |           ^
cave.cpp:80:8: error: 'der' was not declared in this scope; did you mean 'des'?
   80 |    res[der]=a;
      |        ^~~
      |        des
cave.cpp:81:4: error: 'ans' was not declared in this scope; did you mean 'abs'?
   81 |    ans.push_back(des);
      |    ^~~
      |    abs
cave.cpp:85:14: error: expected primary-expression before ']' token
   85 |     answer(s[], ans[]);
      |              ^
cave.cpp:85:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   85 |     answer(s[], ans[]);
      |                 ^~~
      |                 abs
cave.cpp:85:21: error: expected primary-expression before ']' token
   85 |     answer(s[], ans[]);
      |                     ^