Cod sursa(job #1611883)
| Utilizator | Data | 24 februarie 2016 15:49:29 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.64 kb |
#include <bits/stdc++.h>
using namespace std;
const int nmax = 200005;
int main()
{
freopen("heapuri.in", "r", stdin);
freopen("heapuri.out", "w", stdout);
int n, x, dim=0, i, val[nmax], t;
set <int> heap;
scanf("%d", &n);
for(i=1; i<=n; i++)
{
scanf("%d", &t);
if(t==1)
{
scanf("%d", &x);
val[++dim]=x;
heap.insert(x);
}
else if(t==2)
{
scanf("%d", &x);
heap.erase(val[x]);
}
else printf("%d\n", *heap.begin());
}
fclose(stdin);
fclose(stdout);
return 0;
}
