제출 #648861

#제출 시각아이디문제언어결과실행 시간메모리
648861JANCARAPAN동굴 (IOI13_cave)C++17
컴파일 에러
0 ms0 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; // int tryCombination(vector<int> &a); // void answer(vector<int> &a, vector<int> &b); void exploreCave(int n) { vector<int> pos(n), con(n); for (int i=0; i<n; i++) { // per a cada porta faig bs dels interruptors int l = i, r = n + 1; bool on = 1; while (r - l > 1) { int m = (l + r) / 2; bool can = 0; if (tryCombination(pos) == i) { on = 0; can = 1; } for (int j=i; j<m; j++) { pos[j] = 1; } if (tryCombination(pos) == i) { on = 1; can = 1; } if (can) { r = m; } else { l = r; } } pos[i] = on; con[i] = r; } answer(pos, con); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:19:32: error: cannot convert 'std::vector<int>' to 'int*'
   19 |             if (tryCombination(pos) == i) {
      |                                ^~~
      |                                |
      |                                std::vector<int>
In file included from cave.cpp:1:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:26:32: error: cannot convert 'std::vector<int>' to 'int*'
   26 |             if (tryCombination(pos) == i) {
      |                                ^~~
      |                                |
      |                                std::vector<int>
In file included from cave.cpp:1:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:41:12: error: cannot convert 'std::vector<int>' to 'int*'
   41 |     answer(pos, con);
      |            ^~~
      |            |
      |            std::vector<int>
In file included from cave.cpp:1:
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~