Cod sursa(job #2066795)
| Utilizator | Data | 15 noiembrie 2017 15:30:00 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.62 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream in("heapuri.in");
ofstream out("heapuri.out");
int loc ;
int main()
{
multiset <int>heap;
multiset <int>::iterator it;
map <int,int>MAP;
int op , q , x;
in >> q ;
for (int i = 0 ; i < q ; ++ i )
{
in >> op ;
if ( op == 1 ){
in >> x ;
heap.insert(x);
MAP[++loc]=x;
}
else if ( op == 2 )
{
in >> x ;
it = heap.find(MAP[x]);
heap.erase(it);
}
else {
it=heap.begin();
out << * it << '\n';
}
}
return 0;
}
