Cod sursa(job #1760340)
| Utilizator | Data | 20 septembrie 2016 18:12:31 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.62 kb |
#include <iostream>
#include <fstream>
#include <set>
using namespace std;
ifstream in("heapuri.in");
ofstream out("heapuri.out");
int main()
{
multiset <int> heap;
int v[20001];
int op,s=0;
in>>op;
for(int i=1;i<=op;i++)
{
int k;
in>>k;
if(k==1)
{
int x;
in>>x;
v[s++]=x;
heap.insert(x);
}
else if(k==2)
{
int x;
in>>x;
heap.erase(v[x-1]);
}
else
{
out<<*(heap.begin())<<'\n';
}
}
}
