제출 #835015

#제출 시각아이디문제언어결과실행 시간메모리
835015AndrijaM동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; const long long mod=1e9+7; const long long maxn=2e5+10; const long long logn=20; long long di[8]={-1,-1,0,1,1,1,0,-1}; long long dj[8]={0,1,1,1,0,-1,-1,-1}; void exploreCave(int n) { vector<int>a(n,1); vector<int>s(n,1); bool vis[n]; memset(vis,0,sizeof vis); vector<int>d(n); int pr=-1; for(int i=0;i<n;i++) { a=s; int p=tryCombination(a); if(p==pr) { int sw=0; int l=0; int r=n; while(l<r) { int mid=l+(r-l)/2; a=s; for(int idx=mid;idx<n;idx++) { if(!vis[idx]) { a[idx]=sw; } } int pom=tryCombination(a); if(pom>p) { l=mid+1; } else { r=mid; } } vis[l]=1; s[l]=sw; d[i]=l; } else { int sw=1; int l=0; int r=n; while(l<r) { int mid=l+(r-l)/2; a=s; for(int idx=mid;idx<n;idx++) { if(!vis[idx]) { a[idx]=sw; } } int pom=tryCombination(a); if(pom>p) { l=mid+1; } else { r=mid; } } vis[l]=1; s[l]=sw; d[i]=l; } } answer(s,d); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:24:30: error: cannot convert 'std::vector<int>' to 'int*'
   24 |         int p=tryCombination(a);
      |                              ^
      |                              |
      |                              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:41:40: error: cannot convert 'std::vector<int>' to 'int*'
   41 |                 int pom=tryCombination(a);
      |                                        ^
      |                                        |
      |                                        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:71:40: error: cannot convert 'std::vector<int>' to 'int*'
   71 |                 int pom=tryCombination(a);
      |                                        ^
      |                                        |
      |                                        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:86:12: error: cannot convert 'std::vector<int>' to 'int*'
   86 |     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[]);
      |             ~~~~^~~