Pagini recente » Cod sursa (job #3187768) | template/fmi-no-stress-4/footer | Cod sursa (job #781109) | Profil SebicaGPL (nu pgl) | Cod sursa (job #914964)
Cod sursa(job #914964)
#include <iostream>
#include <fstream>
#include <set>
#define nmax 200005
using namespace std;
multiset <int> heap;
int v[nmax];
int main() {
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int n, op, x, cnt = 0;
f>>n;
for(int i=0; i<n; i++) {
f>>op;
if(op==1) { f>>x; heap.insert(x); v[++cnt] = x; }
if(op==2) { f>>x; heap.erase(v[x]); }
if(op==3) { g<<*heap.begin()<<"\n"; }
}
return 0;
}