Cod sursa(job #2568936)
| Utilizator | Data | 4 martie 2020 10:30:55 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.47 kb |
#include <bits/stdc++.h>
#define Nmax 200005
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int N, K;
int pos[Nmax];
multiset<int> s;
int main()
{
f >> N;
while (N--) {
int op, x;
f >> op;
if (op == 3) g << *s.begin() << '\n';
else {
f >> x;
if (op == 1) pos[++K] = x, s.insert(x);
else s.erase(s.lower_bound(pos[x]));
}
}
return 0;
}
