Cod sursa(job #1533393)
Utilizator | Nicu B. NicuCJ | Data | 22 noiembrie 2015 14:48:29 |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.57 kb |
#include <iostream>
#include <fstream>
#include <queue>
#include <set>
using namespace std;
set <int> st;
int main()
{
int n,op,x,m=0,a[200002],i;
ifstream f ("heapuri.in");
ofstream g ("heapuri.out");
f>>n;
for (i=1;i<=n;i++)
{
f>>op;
if (op==1)
{
f>>x;
st.insert(x);
a[++m]=x;
}
if (op==2)
{
f>>x;
st.erase(a[x]);
}
if (op==3)
{
g<<*st.begin()<<"\n";
}
}
return 0;
}