STL优先队列 0 分求助
查看原帖
STL优先队列 0 分求助
690669
Beacon_wolf楼主2023/11/22 22:59
#include<bits/stdc++.h>
using namespace std;
int main(){
	priority_queue<int,vector<int>,greater<int> > q;
	int n;
	cin >> n;
	for(int i = 1;i <= n;i++)
	{
		int op,x;
		cin >> op;
		if(op = 1) {cin >> x;q.push(x);}
		if(op = 2) cout << q.top() << endl;
		if(op = 3) q.pop();
	}
	return 0;
}
2023/11/22 22:59
加载中...