Cod sursa(job #2727868)

Utilizator UnknownPercentageBuca Mihnea-Vicentiu UnknownPercentage Data 22 martie 2021 16:13:26
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.34 kb
#include <bits/stdc++.h>

using namespace std;

ifstream f("heapuri.in");
ofstream g("heapuri.out");

multiset <int> q;

int a[200001];
int N, op, x;

int main(){
	f >> N;
	while(N--){
		f >> op;
		if(op == 1) f >> x, a[++a[0]] = x, q.insert(x);
		if(op == 2) f >> x, q.erase(a[x]);
		if(op == 3) g << *(q.begin()) << "\n"; 
	}
}