Cod sursa(job #1871454)
Utilizator | Osvath Tamas Tomi98 | Data | 7 februarie 2017 13:34:45 |
---|---|---|---|
Problema | Heapuri | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.78 kb |
#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(my_set.find(v[b]));
break;
}
case 3:{
multiset <int> :: iterator it = my_set.begin();
fout << *it <<"\n";
break;
}
}
}
}