Cod sursa(job #3264954)
| Utilizator | Data | 25 decembrie 2024 23:27:55 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.61 kb |
#include <bits/stdc++.h>
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
int q;
multiset<int> s;
int cnt;
array<int,200001> v;
int main() {
fin >> q;
while (q--) {
int t;
fin >> t;
int x;
if (t == 1) {
cnt++;
fin >> x;
s.insert(x);
v[cnt] = x;
} else if (t == 2) {
fin >> x;
s.erase(v[x]);
} else {
fout << *s.begin() << '\n';
}
}
return 0;
}