Cod sursa(job #3131876)
Utilizator | Data | 21 mai 2023 20:32:13 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.34 kb |
#include <fstream>
#include <set>
using namespace std;
int n , t, x , copyt;
multiset<int> heap;
int v[2000001];
int main(){
ifstream f("heapuri.in");
ofstream g("heapuri.out");
f>>n;
while(n-->0){
f>>t;
if(t==1) f>>x, heap.insert(x), v[++copyt]=x;
if(t==2) f>>x, heap.erase(v[x]);
if(t==3) g<<*heap.begin()<<"\n";
}
return 0;
}