제출 #672607

#제출 시각아이디문제언어결과실행 시간메모리
672607paulo_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 <int> ans; int busqueda (bool esuno, int inde, int n){ int izq=1, 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++){ int master=1; 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>=j){ des= busqueda(true,j,N); a=1; } else { des=busqueda(false,j,N); a=0; } activos [des]=true; res[des]=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: In function 'void exploreCave(int)':
cave.cpp:68:21: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int*'
   68 |   ll=tryCombination(s);
      |                     ^
      |                     |
      |                     std::string {aka std::__cxx11::basic_string<char>}
In file included from cave.cpp:2:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:86:12: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int*'
   86 |     answer(s, ans);
      |            ^
      |            |
      |            std::string {aka std::__cxx11::basic_string<char>}
In file included from cave.cpp:2:
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~