Pagini recente » Cod sursa (job #2895486) | Cod sursa (job #2657550) | Clasament corona_day2 | Cod sursa (job #2895477)
#include <iostream>
#include <fstream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int N, x, v[200001], index = 0;
short o;
multiset<int> h;
f>>N;
for (int i = 0; i < N; ++i) {
f>>o;
if (o == 1) {
f>>x;
h.insert(x);
++index;
v[index] = x;
continue;
}
if (o == 2) {
f>>x;
h.erase(v[x]);
continue;
}
g<<*h.begin()<<endl;
}
return 0;
}