Cod sursa(job #781236)

Utilizator oana_popfmi - pop oana oana_pop Data 23 august 2012 22:48:13
Problema Heapuri Scor 40
Compilator cpp Status done
Runda Arhiva educationala Marime 0.64 kb
#include <fstream>
#include <set>
#include<algorithm>
#define Dim 200001
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int main()
{
    int n,cod,k=0,x;
    multiset <int> myset;
    int v[Dim];
    f>>n;
    for(int i=1; i<=n; i++)
    {
            f>>cod;
            if(cod==1)
            {
                      k++;
                      f>>v[k];
                      myset.insert(v[k]);
            }
            else if(cod==2)
            {
                 f>>x;
                 myset.erase(v[x]);
            }
            else g<<*myset.begin()<<endl;
    }
    return 0;
    
    
}