Cod sursa(job #2621726)
| Utilizator | Data | 30 mai 2020 18:08:58 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.62 kb |
#include<bits/stdc++.h>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int n;
multiset<int> heap;
int pozitii[200001];
int main(){
f >> n;
int j = 1;
for(int i = 0; i < n; i++)
{
int op;
f >> op;
if (op == 1)
{
int e;
f >> e;
pozitii[j] = e;
heap.insert(e);
j++;
}
else if (op == 2)
{
int poz;
f >> poz;
heap.erase(pozitii[poz]);
}
else
{g << *heap.begin() << '\n';}
}
f.close();
g.close();
return 0;
}