Cod sursa(job #1845658)
Utilizator | Data | 11 ianuarie 2017 19:21:47 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.54 kb |
#include <fstream>
#include <set>
using namespace std;
set <int> a;
long long n,x,k,i,type,v[100005];
int main()
{
ifstream f("heapuri.in");
ofstream g("heapuri.out");
f>>n;
for(i=1; i<=n; i++)
{
f>>type;
if(type==1)
{
f>>x;
a.insert(x);
k++;
v[k]=x;
}
else if(type==2)
{
f>>x;
a.erase(v[x]);
}
else g<<*a.begin() << '\n';
}
f.close(); g.close();
return 0;
}