1.实验
#include<bits/stdc++.h> using namespace std; int main(){ //auto cmp=[](int a,int b){return a<b;};//3 重定义小于号,即less,是大顶堆,即默认的 auto cmp=[](int a,int b){return a>b;};//1 //重定义大于号,即greater,是小顶堆 priority_queue<int,vector<int>,decltype(cmp)> pq(cmp); pq.push(1); pq.push(2); pq.push(3); cout<<pq.top(); return 0; }