Pagini recente » Cod sursa (job #844916) | Cod sursa (job #1130848) | Cod sursa (job #2110360) | Cod sursa (job #2353129) | Cod sursa (job #3131874)
#include <bits/stdc++.h>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
set<int> heap;
int n;
int main(){
f >> n;
vector<int> pushed;
pushed.push_back(INT32_MIN);
for(int i = 1; i <= n; ++i){
int op;
f >> op;
if(op == 1){
int x;
f >> x;
heap.insert(x);
pushed.push_back(x);
}
else if(op == 2){
int x;
f >> x;
heap.erase(pushed[x]);
pushed[x] = INT32_MIN;
}
else{
g << *heap.begin() << "\n";
}
}
return 0;
}