제출 #713040

#제출 시각아이디문제언어결과실행 시간메모리
713040lam동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; int n; vector <int> dau; vector <int> tmp; vector <int> s, d; void exploreCave(int N) { /* ... */ n=N; dau.assign(n,0); s.assign(n,0); d.assign(n,0); for (int it=0; it<n; it++) { int temp = tryCombination(dau); if (temp > it || temp==-1) { for (int i:tmp) dau[i] ^= 1; temp = tryCombination(dau); } int l = 0; int r=tmp.size()-1; while (l<r) { int mid=(l+r)/2; for (int i=0; i<=mid; i++) dau[tmp[i]]^=1; int val = tryCombination(dau); for (int i=0; i<=mid; i++) dau[tmp[i]]^=1; if (val>it||val==-1) r=mid; else l=mid+1; } d[it] = tmp[r]; dau[d[it]] ^= 1; for (int i=r+1; i<tmp.size(); i++) swap(tmp[i],tmp[i-1]); tmp.pop_back(); } answer(dau,d); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:16:35: error: cannot convert 'std::vector<int>' to 'int*'
   16 |         int temp = tryCombination(dau);
      |                                   ^~~
      |                                   |
      |                                   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:20:35: error: cannot convert 'std::vector<int>' to 'int*'
   20 |             temp = tryCombination(dau);
      |                                   ^~~
      |                                   |
      |                                   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:27:38: error: cannot convert 'std::vector<int>' to 'int*'
   27 |             int val = tryCombination(dau);
      |                                      ^~~
      |                                      |
      |                                      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:34:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |         for (int i=r+1; i<tmp.size(); i++) swap(tmp[i],tmp[i-1]);
      |                         ~^~~~~~~~~~~
cave.cpp:37:12: error: cannot convert 'std::vector<int>' to 'int*'
   37 |     answer(dau,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[]);
      |             ~~~~^~~