Cod sursa(job #1577836)
| Utilizator | Data | 23 ianuarie 2016 21:46:20 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.43 kb |
#include <fstream>
#include <set>
#define Nmax 200010
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
set <int> heap;
int n,t,nr=1,v[Nmax];
long long x;
int main()
{f>>n;
for(int i=1;i<=n;i++)
{f>>t;
if(t==1)
{f>>x;
v[nr++]=x;
heap.insert(x);
}
if(t==2)
{f>>x;
heap.erase(v[x]);
}
if(t==3)
g<<*heap.begin()<<'\n';//sau cu iterator
}
return 0;
}
