需要的头文件:
#include<iostream>
#include<queue>
using namespace std;
priority_queue<int,vector<int>,less<int> > p;(>与>之间要空开,less是从大到小,这里不需要加<verctor>头文件)
priority_queue<int,vector<int>,greater<int> > p;(>与>之间要空开,greater是从小到大,这里不需要加<verctor>头文件)
当运用结构体时,划线的代表按b的值从小到大排序。
具体我是看(8条消息) 【原创】优先队列 priority_queue 详解_致上-CSDN博客_优先队列这位作者的