제출 #790014

#제출 시각아이디문제언어결과실행 시간메모리
790014Bula동굴 (IOI13_cave)C++17
컴파일 에러
0 ms0 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() //#define int ll const ll mod=1e9+7; void exploreCave(int n){ vector<int> c(n,1),d(n),t(n); int p = tryCombination(c); if (p == -1) p = n; for (int i = 0 ; i < n ; i++){ if(p > i){ int l = 0, r = n - 1; while(l < r){ int m = (l + r) / 2; vector<int> cur = c; for(int j = l ; j <= m ; j++){ if(t[j] == 0) cur[i] = 0; } int k = tryCombination(cur); if(k == -1) k = n; if(k == i) r = m; else l = m + 1; } t[l] = 1; c[l] = 1; d[i] = l; } if(p == i){ int l = 0, r = n - 1; while(l < r){ int m = (l + r) / 2; vector<int> cur = c; for(int j = l ; j <= m ; j++){ if(t[j] == 0) cur[i] = 0; } int k = tryCombination(cur); if(k == -1) k = n; if(k >= i) r = m; else l = m + 1; } t[l] = 1; c[l] = 0; d[i] = l; } } answer(c,d); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:14:25: error: cannot convert 'std::vector<int>' to 'int*'
   14 |  int p = tryCombination(c);
      |                         ^
      |                         |
      |                         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:25:28: error: cannot convert 'std::vector<int>' to 'int*'
   25 |     int k = tryCombination(cur);
      |                            ^~~
      |                            |
      |                            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:42:28: error: cannot convert 'std::vector<int>' to 'int*'
   42 |     int k = tryCombination(cur);
      |                            ^~~
      |                            |
      |                            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:52:9: error: cannot convert 'std::vector<int>' to 'int*'
   52 |  answer(c,d);
      |         ^
      |         |
      |         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[]);
      |             ~~~~^~~