Cod sursa(job #2001636)
| Utilizator | Data | 17 iulie 2017 12:17:50 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.57 kb |
#include <fstream>
#include <set>
using namespace std;
ifstream fi("heapuri.in");
ofstream fo("heapuri.out");
int n,i,x,V[200001],cod,nr=0;
multiset <int> S;
int main()
{
fi>>n;
for(i=1;i<=n;i++)
{
fi>>cod;
if(cod==3)
fo<<(*S.begin())<<'\n';
if(cod==2)
{
fi>>x;
S.erase(S.find(V[x]));
}
if(cod==1)
{
fi>>x;
nr++;
V[nr]=x;
S.insert(x);
}
}
fi.close();
fo.close();
return 0;
}
