Cod sursa(job #1379941)
| Utilizator | Data | 6 martie 2015 20:34:18 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.58 kb |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200010;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
int m, tip, x, ord[MAXN], cnt;
set <int> heap;
int main()
{
fin >> m;
for (; m; --m)
{
fin >> tip;
if (tip == 3) fout << *heap.begin() << '\n';
else
{
fin >> x;
if (tip == 1)
{
heap.insert(x);
ord[++cnt] = x;
}
else
{
heap.erase(heap.find(ord[x]));
}
}
}
return 0;
}
