Cod sursa(job #2727964)

Utilizator UnknownPercentageBuca Mihnea-Vicentiu UnknownPercentage Data 22 martie 2021 17:31:45
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");
 
set <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"; 
	}
}