Pagini recente » Cod sursa (job #916004) | Cod sursa (job #3212690)
#include <fstream>
#include <set>
#include <vector>
#define dim 200005
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
multiset<int> h;
int a[dim];
int main()
{
int n, x, op, m = 0;
fin >> n;
for (int i = 1; i <= n; i++) {
fin >> op;
if (op == 1) {
fin >> x;
a[++m] = x;
h.insert(x);
}
else if (op == 2) {
fin >> x;
h.erase(a[x]);
}
else {
multiset<int> :: iterator mini = h.begin();
fout << *mini << "\n";
}
}
return 0;
}