Cod sursa(job #2361212)
Utilizator | Data | 2 martie 2019 13:48:07 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.51 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
vector <int> k;
set <int> heap;
int n,a,x;
int main()
{
f>>n;
for(int i=1;i<=n;i++)
{ f>>a;
if(a==1)
{f>>x;
heap.insert(x);
k.push_back(x);
}
else
if(a==3)
{
g<<*heap.begin()<<'\n';
}
else
if(a==2)
{
f>>x;
heap.erase(k[x-1]);
}
}
return 0;
}