제출 #530047

#제출 시각아이디문제언어결과실행 시간메모리
530047buidangnguyen05동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
/* input */ #include "cave.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 5e3; int n; vector<int> done, state, que; int query(int cnt) { for (int i = 0; i < n; ++i) { if (done[i]) que[i] = state[i]; else if (cnt) que[i] = 1; else que[i] = 0; if (!done[i] && cnt) --cnt; } return tryCombination(query); } void exploreCave(int _n) { n = _n; done.resize(n); state.resize(n); que.resize(n); int prev = query(0); for (int i = 0; i < n; ++i) { int L = 0, R = n - 1, pos = 0; while (L <= R) { int mid = (L + R) >> 1; int cur = query(mid); if ((prev == i && cur > i) || (prev != i && cur == i)) { pos = mid; R = mid - 1; } else L = mid + 1; } if (prev == i) state[pos] = 1; done[pos] = i; prev = query(0); } }

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

cave.cpp: In function 'int query(int)':
cave.cpp:21:24: error: cannot convert 'int (*)(int)' to 'int*'
   21 |  return tryCombination(query);
      |                        ^~~~~
      |                        |
      |                        int (*)(int)
In file included from cave.cpp:5:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~