Cod sursa(job #1379944)
| Utilizator | Data | 6 martie 2015 20:34:57 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.57 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(ord[x]);
}
}
}
return 0;
}
