Cod sursa(job #914964)
Utilizator | Data | 14 martie 2013 17:01:20 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.41 kb |
#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;
}