제출 #637037

#제출 시각아이디문제언어결과실행 시간메모리
637037bonk동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; void exploreCave(int n){ vector<int>s(n, -1), d(n); vector<bool>mark(n); for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++) if(!mark[j]) s[j] = 0; int x = tryCombination(s); if(x == i){ for(int j = 0; j < n; j++) if(!mark[j]) s[j] = 1; } int l = 0, r = n - 1; int a = 0; while(l <= r){ int mid = (l + r)/2; for(int j = 0; j < mid; j++) if(!mark[j]) s[j] ^= 1; int tmp = tryCombination(s); if(tmp == -1) tmp = n + 1; if(tmp > i){ a = mid; l = mid + 1; } else{ r = mid - 1; } for(int j = 0; j < mid; j++) if(!mark[j]) s[j] ^= 1; } mark[a] = true; d[a] = i; } answer(s, d); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:11:32: error: cannot convert 'std::vector<int>' to 'int*'
   11 |         int x = tryCombination(s);
      |                                ^
      |                                |
      |                                std::vector<int>
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:22:38: error: cannot convert 'std::vector<int>' to 'int*'
   22 |             int tmp = tryCombination(s);
      |                                      ^
      |                                      |
      |                                      std::vector<int>
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:37:12: error: cannot convert 'std::vector<int>' to 'int*'
   37 |     answer(s, d);
      |            ^
      |            |
      |            std::vector<int>
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[]);
      |             ~~~~^~~