能过样例但是wa,不知道哪错了
查看原帖
能过样例但是wa,不知道哪错了
906545
Apple3楼主2024/3/28 15:49
#include <bits/stdc++.h>
using namespace std;

priority_queue<long long,vector<long long>,greater<long long>>q;

int main(){
	int Q;cin>>Q;
	long long sum=0;
	while(Q--){
		int x;cin>>x;
		if(x==1) {
			int t;cin>>t;
			q.push(t-sum);
		}
		else if(x==2) {
			int t;cin>>t;
			sum+=t;
		}
		else if(x==3) {
			cout<<q.top()+sum<<'\n';
			q.pop();
		}
	}
    return 0;
}
2024/3/28 15:49
加载中...