Cod sursa(job #1040848)
Utilizator | Data | 24 noiembrie 2013 23:45:22 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.51 kb |
#include<fstream>
#include<set>
#define NM 200100
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int A[NM],x,t,n,i,k;
multiset<int> s;
int main ()
{
f>>n;
for(i=1;i<=n;++i)
{
f>>t;
if(t==1)
{
f>>x;
A[++k]=x;
s.insert(x);
}
else
if(t==2)
{
f>>x;
s.erase(A[x]);
}
else
g<<*s.begin()<<"\n";
}
return 0;
}