Cod sursa(job #1111593)
| Utilizator | Data | 18 februarie 2014 23:12:35 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.49 kb |
#include <iostream>
#include <fstream>
#include <set>
#include <vector>
using namespace std;
int n, c, x;
multiset<int> heap;
vector<int> v;
int main(){
ifstream f("heapuri.in");
ofstream g("heapuri.out");
f>>n;
v.push_back(-1);
for(int i=0;i<n;i++){
f>>c;
if(c==1)
f>>x, heap.insert(x), v.push_back(x);
if(c==2)
f>>x, heap.erase(v[x]);
if(c==3)
g<<*heap.begin()<<"\n";
}
return 0;
}
