Cod sursa(job #2925305)
| Utilizator | Data | 13 octombrie 2022 23:13:00 | |
|---|---|---|---|
| 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");
int main()
{
int n;
fin >> n;
multiset<int> set;
vector<int> v;
for(int i = 1; i <= n; i++)
{
int type;
fin >> type;
if(type == 1)
{
int x;
fin >> x;
set.insert(x);
v.push_back(x);
}
else if (type == 2)
{
int x;
fin >> x;
set.erase(set.find(v[x - 1]));
}
else
{
fout << *set.begin() << "\n";
}
}
return 0;
}
