Cod sursa(job #2543213)
Utilizator | Data | 10 februarie 2020 22:32:16 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.66 kb |
#include <fstream>
#include <set>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
multiset <int> q;
multiset <int> :: iterator it;
int v[200002];
int main()
{
int n,c,x,nr=0;
f>>n;
while(n--)
{
f>>c;
if(c==1)
{
f>>x;
++nr;
v[nr]=x;
q.insert(x);
}
else
{
if(c==2)
{
f>>x;
q.erase(v[x]);
}
else
{
it=q.begin();
g<<*it<<'\n';
}
}
}
return 0;
}