Cod sursa(job #1269340)
Utilizator | Data | 22 noiembrie 2014 09:35:27 | |
---|---|---|---|
Problema | Heapuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.49 kb |
#include<fstream>
#include<set>
using namespace std;
int v[200001],k2,k3=1;
int main()
{
ifstream fcin("heapuri.in");
ofstream fcout("heapuri.out");
multiset <int> heap;
multiset <int> :: iterator k;
int n,i,x,y,nr;
fcin>>n;
for(i=1;i<=n;i++)
{
fcin>>x;
if(x!=3)fcin>>y;
if(x==1)
{
heap.insert(y);
v[++k2]=y;
}
else if(x==3)
{
k=heap.begin();
fcout<<*k;
}
else
{
k3++;
heap.erase(heap.find(v[k3]));
}
}
return 0;
}