Cod sursa(job #1880139)
| Utilizator | Data | 15 februarie 2017 15:51:52 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.6 kb |
#include <cstdio>
#include <set>
#include <vector>
using namespace std;
multiset <int> v;
vector <int> cron;
int main() {
freopen("heapuri.in", "r", stdin);
freopen("heapuri.out", "w", stdout);
int t, x, tip;
scanf("%d", &t);
while(t--) {
scanf("%d", &tip);
if(tip == 1) {
scanf("%d", &x);
cron.push_back(x);
v.insert(x);
} else if(tip == 2) {
scanf("%d", &x);
v.erase(cron[x - 1]);
} else {
printf("%d\n", *v.begin());
}
}
return 0;
}
