社区讨论
为什么“重定向pair的<”对“priority_queue”不起作用
学术版参与者 7已保存回复 17
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 17 条
- 当前快照
- 1 份
- 快照标识符
- @lo8clfs9
- 此快照首次捕获于
- 2023/10/27 16:25 2 年前
- 此快照最后确认于
- 2023/10/27 16:25 2 年前
看代码
CPP#include<bits/stdc++.h>
using namespace std;
bool operator < (const pair<int,int> &a, const pair<int,int> &b)
{
return a.second>b.second;
}
priority_queue<pair<int,int> >q;
int main()
{
q.push(make_pair(1, 2));
q.push(make_pair(1,10));
cout<<q.top().second<<endl;
printf("%d",make_pair(1, 2)<make_pair(1, 10));
}
输出
CPP10
0
虚心求教
回复
共 17 条回复,欢迎继续交流。
正在加载回复...