Cod sursa(job #2744473)
| Utilizator | Data | 24 aprilie 2021 18:50:59 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.63 kb |
#include <bits/stdc++.h>
using namespace std;
set<int> heap;
vector<int> ap;
int main()
{
freopen("heapuri.in", "r", stdin);
freopen("heapuri.out", "w", stdout);
int n, cod, x;
scanf("%d", &n);
for(int i=0; i<n; ++i)
{
scanf("%d", &cod);
if(cod==1)
{
scanf("%d", &x);
heap.insert(x);
ap.push_back(x);
}
else if(cod==2)
{
scanf("%d", &x);
heap.erase(ap[x-1]);
}
else
{
printf("%d\n", *heap.begin());
}
}
return 0;
}
