priority_queue
默认是大根堆!!!
查询gcc的头文件,其默认模板:
template<typename _Tp, typename _Sequence = vector<_Tp>,
typename _Compare = less<typename _Sequence::value_type> >
它用less
!less
的定义如下:
template<typename _Tp>
struct less : public binary_function<_Tp, _Tp, bool>
{
_GLIBCXX14_CONSTEXPR
bool
operator()(const _Tp& __x, const _Tp& __y) const
{ return __x < __y; }
};
因此,在用另外一个全局数组h[][]
比较时,
函数类cmp
的比较operator()(a, b)
得写成>
的
比如:
struct cmp
{
bool operator()(const pair<int, int> &a, const pair<int, int> &b) { return h[a.first][a.second] > h[b.first][b.second]; }
};
不然就会WA 40pts