Cod sursa(job #3341722)
| Utilizator | Data | 20 februarie 2026 18:41:09 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.71 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
const int NMAX = 2e5 + 1;
int n, order[NMAX], p = 0;
int main()
{
fin >> n;
multiset<int> heap;
while(n--)
{
int tip;
fin >> tip;
if(tip == 1)
{
int val;
fin >> val;
heap.insert(val);
order[++p] = val;
}
else if(tip == 2)
{
int t;
fin >> t;
auto it = heap.lower_bound(order[t]);
heap.erase(it);
}
else
fout << *heap.begin() << "\n";
}
fin.close();
fout.close();
return 0;
}
