Pagini recente » Cod sursa (job #871571) | Cod sursa (job #11432) | Cod sursa (job #2377163) | Cod sursa (job #3126528) | Cod sursa (job #2237787)
#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';
}
}
}