제출 #1086934

#제출 시각아이디문제언어결과실행 시간메모리
1086934MateiKing80동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; #define fr first #define sc second /* vector<int> ss, dd; int n; void init() { cin >> n; for(int i = 0; i < n; i ++) cin >> ss[i]; for(int i = 0; i < n; i ++) cin >> dd[i]; } int tryCombination(vector<int> s) { vector<int> bn(n); for(int i = 0; i < n; i ++) }*/ void exploreCave(int n) { //init(); const int lg = (int)log2(n); vector<pii> ans; vector<bool> f(n, false); for(int i = 0; i < n; i ++) { vector<int> sus; for(int j = 0; j < n; j ++) sus.pb(1); for(auto j : ans) sus[j.fr] = j.sc; bool turip = (tryCombination(sus) == i); int pas = 1 << lg, pos = -1; while(pas) { vector<int> di(n, 1); for(int j = 0; j <= max(n - 1, pos + pas); j ++) di[j] = 0; for(auto j : ans) di[j.fr] = j.sc; bool nturip = (tryCombination(sus) == i); if(nturip == turip) pos += pas; pas /= 2; } pos ++; if(turip) ans.push_back({pos, 0}); else ans.push_back({pos, 1}); } vector<int> s(n), d(n); int sus = 0; for(auto i : ans) s[i.fr] = i.sc, d[sus ++] = i.fr; answer(s, d); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:39:17: error: 'class std::vector<int>' has no member named 'pb'
   39 |             sus.pb(1);
      |                 ^~
cave.cpp:42:38: error: cannot convert 'std::vector<int>' to 'int*'
   42 |         bool turip = (tryCombination(sus) == 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:51:43: error: cannot convert 'std::vector<int>' to 'int*'
   51 |             bool nturip = (tryCombination(sus) == 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:66:12: error: cannot convert 'std::vector<int>' to 'int*'
   66 |     answer(s, d);
      |            ^
      |            |
      |            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[]);
      |             ~~~~^~~