Cod sursa(job #2678086)
| Utilizator | Data | 28 noiembrie 2020 10:13:42 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 40 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.62 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream in("heapuri.in");
ofstream out("heapuri.out");
set < int > heap;
set < int > :: iterator it;
map < int , int > hashis;
int cnt;
int main(){
int n, caz, x;
in>>n;
while(n--){
in>>caz;
if(caz == 3){
it = heap.begin();
out<<*it<<"\n";
}
else{
in>>x;
if(caz == 1)
heap.insert(x), hashis[++cnt] = x;
else{
if(hashis[x]){
heap.erase(hashis[x]);
}
}
}
}
}
