Cod sursa(job #915867)
| Utilizator | Data | 15 martie 2013 14:05:06 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.54 kb |
#include<fstream>
#include<set>
#define MAX_SIZE 200005
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int n,v[MAX_SIZE];
multiset <int> heap;
int main()
{
f>>n;
int tip,x,pos=0;
for(int i(1); i <= n; ++i )
{f>>tip;
if(tip == 1)
{
f>>x;
heap.insert(x);
v[++pos]=x;
continue;
}
if( tip == 2)
{
f>>x;
heap.erase(v[x]);
continue;
}
if(tip == 3)
{
g<<*heap.begin()<<"\n";
continue;
}
}
f.close();
g.close();
return 0;
}