제출 #988724

#제출 시각아이디문제언어결과실행 시간메모리
988724lalig777동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include"cave.h" #include <iostream> #include <vector> using namespace std; void exploreCave(int N){ vector<int>confirmat(N, false); vector<int>comb(N, 0); vector<int>porta(N, -1); bool funcionaba, funciona; int act; for (int i=0; i<N; i++){ int doorsleft=N-i, left=0, right=N-1; for (int i=0; i<N; i++){ if (confirmat[i]!=true){ left=i; break; } }for (int i=N-1; i>=0; i--){ if (confirmat[i]!=true){ right=i; break; } }act=tryCombination(comb); if (act!=i) funcionaba=true; else funcionaba=false; int r=N-1; while (left!=right){ int sobra=doorsleft%2; doorsleft/=2; int j=doorsleft; for (int i=left; i<=right; i++){ if (confirmat[i]==true) continue; else{ j--; comb[i]=1-comb[i]; if (j==0){ r=i; break; } } } act=tryCombination(comb); if (act!=i) funciona=true; else funciona=false; if (funciona!=funcionaba){ right=r; }else{ doorsleft+=sobra; for (int i=r+1; i<N; i++){ if (confirmat[i]!=true){ left=i; break; } } }funcionaba=funciona; }if (funciona==false) comb[left]=1-comb[left]; confirmat[left]=true; porta[left]=i; }answer(comb, porta); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:24:29: error: cannot convert 'std::vector<int>' to 'int*'
   24 |         }act=tryCombination(comb);
      |                             ^~~~
      |                             |
      |                             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:43:32: error: cannot convert 'std::vector<int>' to 'int*'
   43 |             act=tryCombination(comb);
      |                                ^~~~
      |                                |
      |                                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:60:13: error: cannot convert 'std::vector<int>' to 'int*'
   60 |     }answer(comb, porta);
      |             ^~~~
      |             |
      |             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[]);
      |             ~~~~^~~