堆
2023-08-06 14:12:09
发布于:浙江
#include<bits/stdc++.h>
using namespace std;
priority_queue<int,vector<int>,less<int> >q;
priority_queue<int,vector<int>,greater<int> >p;
int main(){
q.push(1);
q.push(2);
q.push(3);
while(!q.empty()){
cout<<q.top()<<" ";
q.pop();
}
cout<<endl;
p.push(1);
p.push(2);
p.push(3);
while(!p.empty()){
cout<<p.top()<<" ";
p.pop();
}
return 0;
}
这里空空如也
有帮助,赞一个