Cod sursa(job #3286223)
| Utilizator | Data | 13 martie 2025 20:34:48 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.62 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
multiset<int> s;
int a[200005];
int n;
int main()
{
ios_base::sync_with_stdio(0);
fin.tie(0);
fout.tie(0);
int task, x, poz = 0;
fin >> n;
while(n--)
{
fin >> task;
if(task == 1)
{
fin >> x;
s.insert(x);
a[++poz] = x;
}
else if(task == 2)
{
fin >> x;
s.erase(s.find(a[x]));
}
else
fout << *s.begin() << "\n";
}
return 0;
}
