Pagini recente » Cod sursa (job #1042769) | Cod sursa (job #674404) | Cod sursa (job #1145611) | Cod sursa (job #2394126) | Cod sursa (job #2133337)
#include <bits/stdc++.h>
using namespace std;
int n, k, pos[200005];
set <pair<int,int> > S;
int main(){
ifstream cin ("heapuri.in");
ofstream cout ("heapuri.out");
cin >> n;
while (n--){
int o, x;
cin >> o;
if (o == 1) cin >> x, S.insert({x,++k}), pos[k] = x;
else if (o == 2) cin >> x, S.erase(S.find({pos[x], x}));
else cout << S.begin()->first << "\n";
}
return 0;
}