今天才知道$lower\_bound$最后有一个优先级参数……

首先$lower\_bound$中的优先级和序列优先级必须相同才有效

$lower\_bound$中优先级默认的是小于号,也就是说仅当序列从小到大排序时才有效

 

可以选择重载小括号/小于号,或者直接写$bool$函数

bool cmp (int a,int b)
{return a>b;}
struct cmp
{
    bool operator () (int a,int b)
    {return a>b;}
};

如果是结构体写法调用时要记得加括号

相关文章:

  • 2022-12-23
  • 2021-11-16
  • 2022-12-23
  • 2022-12-23
  • 2021-06-19
  • 2021-09-26
猜你喜欢
  • 2021-10-23
  • 2021-09-09
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
  • 2021-07-18
  • 2021-07-06
相关资源
相似解决方案