Cod sursa(job #2066791)

Utilizator eduardandrei20Nechifor Eduard Andrei eduardandrei20 Data 15 noiembrie 2017 15:18:06
Problema Heapuri Scor 40
Compilator cpp Status done
Runda Arhiva educationala Marime 0.66 kb
#include <iostream>
#include <set>
#include <vector>
#include <fstream>
using namespace std;
ifstream in("heapuri.in");
ofstream out("heapuri.out");

int main()
{
  multiset <int>heap;
     multiset <int>::iterator it;
vector<int>v;
vector<int>::iterator IT;
  int op , q , x;
  in >> q ;
  for (int i = 0 ; i < q ;  ++ i )
  {

       in >> op ;
       if ( op == 1 ){
        in >> x ;
        heap.insert(x);
        v.push_back(x);
       }
       else if ( op == 2 )
       {
           int poz ;  in >> poz; heap.erase(heap.find(v[poz-1]));

       }
else {
    it=heap.begin();
    out << * it << endl;
}

  }



    return 0;
}