Cod sursa(job #2746336)
| Utilizator | Data | 27 aprilie 2021 18:25:30 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.59 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
long N,cod,x,p,ord[1000000];
set<long> h;
int main()
{
f>>N;
for(int i=1; i<=N; i++)
{
f>>cod;
if(cod!=3)
f>>x;
switch(cod)
{
case 1:
{
h.insert(x);
ord[++p]=x;
}
break;
case 2:
h.erase(ord[x]);
break;
case 3:
{g<<*h.begin();
g<<'\n';}
break;
}
}
return 0;
}
