제출 #295779

#제출 시각아이디문제언어결과실행 시간메모리
295779Ahmad_Hasan동굴 (IOI13_cave)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; void exploreCave(int n){ vector<int>fnd(n,-1); vector<int>kys(n,-1); vector<int>stt(n,-1); vector<int>s2(n,-1),d(n,-1); for(int i=0;i<n;i++){ vector<int>s(n,1); for(int j=0;j<n;j++){ if(d[j]!=-1){ s[j]=s2[j]; } } int inp; inp=tryCombination(s); int st; if(inp>i||inp==-1){ st=1; }else{ st=0; } stt[i]=st; int l=0,r=n-1; while(l<=r){ int mid=l+(r-l)/2; for(int j=l;j<=mid;j++){ if(d[j]!=-1){ s[j]=s2[j]; }else{ s[j]=st; } } for(int j=mid+1;j<=r;j++){ if(d[j]!=-1){ s[j]=s2[j]; }else{ s[j]=!st; } } inp=tryCombination(s); int nst; if(inp>i||inp==-1){ r=mid; }else{ l=mid+1; } if(l==r){ fnd[i]=l; d[l]=i; s2[l]=st; break; } } } answer(s2,d); } /*** 8 5 3 1 7 0 6 4 0 5 5 7 */

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:20:28: error: cannot convert 'std::vector<int>' to 'int*'
   20 |         inp=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:46:32: error: cannot convert 'std::vector<int>' to 'int*'
   46 |             inp=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:47:17: warning: unused variable 'nst' [-Wunused-variable]
   47 |             int nst;
      |                 ^~~
cave.cpp:62:12: error: cannot convert 'std::vector<int>' to 'int*'
   62 |     answer(s2,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[]);
      |             ~~~~^~~