Cod sursa(job #758769)

Utilizator Theorytheo .c Theory Data 16 iunie 2012 12:45:25
Problema Heapuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.78 kb
#include<fstream>
#include<set>
#define nmax 200008
using namespace std;

ifstream fin("heapuri.in");
ofstream fout("heapuri.out");

int N, op, type, x, Z[nmax], nr;

multiset<int> V;
//multiset<int>::iterator it;

int main()
{
    fin >> N;
    for(int i = 1; i <= N; i++ )
    {
        fin >>type;
        switch(type){
         case 1:
         {
             fin >> x;
             Z[++nr] = x;

             V.insert(x);
             break;
         }
         case 2:
         {
             fin >> x;
             V.erase(V.find(Z[x]));
             break;
         }
         default :{

             //it = V.begin();
             fout << *V.begin() <<'\n';
             break;
         }
        }

    }
    fin.close();
    return 0;
}