제출 #231068

#제출 시각아이디문제언어결과실행 시간메모리
231068Tehillah동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include "cave.h" #include <vector> #include <set> using namespace std; void exploreCave(int N) { vector<int> S(N, 1), D(N); int ret; while(1) { ret = tryCombination(S); if(ret == -1) break; else S[ret] = !S[ret]; } set<int> st; for(int i=0; i<N; ++i) { //closing 'i'th door S[i] = !S[i]; ret = tryCombination(S); assert(ret != -1); D[i] = ret; st.insert(ret); //open 'i'th door S[i] = !S[i]; } assert((int)st.size() == N); answer(S, D); return; }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:11:25: error: cannot convert 'std::vector<int>' to 'int*' for argument '1' to 'int tryCombination(int*)'
   ret = tryCombination(S);
                         ^
cave.cpp:19:25: error: cannot convert 'std::vector<int>' to 'int*' for argument '1' to 'int tryCombination(int*)'
   ret = tryCombination(S);
                         ^
cave.cpp:20:3: error: 'assert' was not declared in this scope
   assert(ret != -1);
   ^~~~~~
cave.cpp:20:3: note: suggested alternative: 'answer'
   assert(ret != -1);
   ^~~~~~
   answer
cave.cpp:26:2: error: 'assert' was not declared in this scope
  assert((int)st.size() == N);
  ^~~~~~
cave.cpp:26:2: note: suggested alternative: 'answer'
  assert((int)st.size() == N);
  ^~~~~~
  answer
cave.cpp:27:13: error: cannot convert 'std::vector<int>' to 'int*' for argument '1' to 'void answer(int*, int*)'
  answer(S, D);
             ^