Pagini recente » Cod sursa (job #1142236) | Cod sursa (job #2699894) | Cod sursa (job #2982503) | Cod sursa (job #2365024) | Cod sursa (job #3131033)
#include<iostream>
#include<fstream>
#include <set>
std::ifstream input_file("heapuri.in");
std::ofstream output_file("heapuri.out");
std::set<int>heap;
int main(){
int history[200001];
int n,command, number;
input_file>>n;
int no_elements=0;
for(int i=1;i<=n;i++){
input_file>>command;
if(command==1){
input_file>>number;
history[++no_elements]=number;
heap.insert(number);
}
else if(command==2){
input_file>>number;
heap.erase(history[number]);
}
else if(command==3){
output_file<<*heap.begin()<<"\n";
}
}
input_file.close();
output_file.close();
return 0;
}