Pagini recente » Cod sursa (job #3228147) | Cod sursa (job #2906294) | Cod sursa (job #3301227) | Cod sursa (job #2398267) | Cod sursa (job #2819401)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
set<int> h;
int n, x, p, k;
int loc[200005];
int main() {
fin >> n;
for (int i=1;i<=n;i++){
fin >> p;
if (p == 1){
fin >> x;
h.insert(x);
loc[++k] = x;
}else if (p == 2){
fin >> x;
h.erase(loc[x]);
}else{
fout << *h.begin() << '\n';
}
}
return 0;
}