Cod sursa(job #2237787)
| Utilizator | Data | 3 septembrie 2018 03:25:03 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.63 kb |
#include <bits/stdc++.h>
using namespace std;
int num_operations;
set<int> myHeap;
vector<int> read_order;
int main() {
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
fin>>num_operations;
while(num_operations--) {
int operation_type;
fin>>operation_type;
if(operation_type==1) {
int value;
fin>>value;
read_order.push_back(value);
myHeap.insert(value);
} else if(operation_type==2) {
myHeap.erase(read_order.back());
} else {
fout<<*(myHeap.begin())<<'\n';
}
}
}
