Cod sursa(job #3286968)
Utilizator | Data | 14 martie 2025 21:06:00 | |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.62 kb |
#include <bits/stdc++.h>
using namespace std;
const int MAX = 200005;
int a[MAX], k;
int main()
{
ifstream cin("heapuri.in");
ofstream cout("heapuri.out");
int q;
cin >> q;
multiset<int> s;
while (q--)
{
int op;
cin >> op;
if (op == 1)
{
int x;
cin >> x;
s.insert(x);
a[++k] = x;
}
else if (op == 2)
{
int x;
cin >> x;
s.erase(s.find(a[x]));
}
else
cout << *s.begin() << "\n";
}
return 0;
}