Pagini recente » Cod sursa (job #2764925) | Cod sursa (job #912427) | Cod sursa (job #2866339) | Cod sursa (job #2303432) | Cod sursa (job #1873598)
#include <fstream>
#include <set>
#include <iterator>
#define dim 200001
using namespace std;
multiset <int> my_set;
int n, a, b, j, v[dim];
int main(){
ifstream fin ("heapuri.in");
ofstream fout("heapuri.out");
fin >> n;
for(int i = 1; i <= n; i++){
fin >> a;
switch(a){
case 1:{
fin >> b;
v[++j] = b;
my_set.insert(b);
break;
}
case 2:{
fin >> b;
my_set.erase(v[b]);
break;
}
case 3:{
multiset <int> :: iterator it = my_set.begin();
fout << *it <<"\n";
break;
}
}
}
}