Cod sursa(job #2133337)
| Utilizator | Data | 16 februarie 2018 20:08:06 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.45 kb |
#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;
}
