제출 #774843

#제출 시각아이디문제언어결과실행 시간메모리
774843khshg동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include "cave.h" #include<bits/stdc++.h> using namespace std; void exploreCave(int N) { vector<int> cor(N), DtoS(N), StoD(N); for(int i = 0; i < N; ++i) { bool f = (tryCombination(cor) == i); int tl = 0, tr = N - 1; while(tl < tr) { int tm = (tl + tr) / 2; vector<int> ask(N); for(int j = 0; j <= tm; ++j) { ask[j] = 1; } for(int j = 0; j < i; ++j) ask[DtoS[j]] = cor[DtoS[j]]; bool F = (tryCombination(ask) == i); if(F == f) { tl = tm + 1; } else tr = tm; } DtoS[i] = tm; StoD[tm] = i; cor[tm] = !f; } answer(cor, StoD); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:8:28: error: cannot convert 'std::vector<int>' to 'int*'
    8 |   bool f = (tryCombination(cor) == 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:17:29: error: cannot convert 'std::vector<int>' to 'int*'
   17 |    bool F = (tryCombination(ask) == 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:22:15: error: expected primary-expression before ';' token
   22 |   DtoS[i] = tm;
      |               ^
cave.cpp:23:10: error: expected primary-expression before ']' token
   23 |   StoD[tm] = i;
      |          ^
cave.cpp:24:9: error: expected primary-expression before ']' token
   24 |   cor[tm] = !f;
      |         ^
cave.cpp:26:9: error: cannot convert 'std::vector<int>' to 'int*'
   26 |  answer(cor, StoD);
      |         ^~~
      |         |
      |         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[]);
      |             ~~~~^~~