Cod sursa(job #3033300)

Utilizator BadHero112Ursu Vasile BadHero112 Data 23 martie 2023 18:16:30
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.62 kb
#include <bits/stdc++.h>
using ll=long long;
#define S second
#define F first
#define endl '\n'
#define spid ios_base::sync_with_stdio(false);cin.tie(NULL);
const int mod=1e9+7;
const double pi=3.14159265359;
const int maxn=200001;
using namespace std;

int n,ord[maxn];

multiset<int> A;

int main(){
	ifstream cin("heapuri.in");
	ofstream cout("heapuri.out");
	cin>>n;
	int ins=1;
	for(int i=1;i<=n;i++){
		int c;
		cin>>c;
		if(c==1){
			cin>>ord[ins];
			A.insert(ord[ins]);
			ins++;
		}
		else if(c==2){
			int x;
			cin>>x;
			A.erase(ord[x]);
		}
		else cout<<*A.begin()<<endl;
		
	}
}