自定义排序函数
struct cmp1{
bool operator()(int x,int y)
{
return x>y;//小的优先级高 ,从小到大排
}
};
priority_queue<int,vector<int>,cmp1>q2;struct Student {
string name;
int num;
int age;
bool operator<(const Student &stu) const {
return stu.age < this->age;
}
};
priority_queue<Student> q;最后更新于