Cod sursa(job #2066796)

Utilizator eduardandrei20Nechifor Eduard Andrei eduardandrei20 Data 15 noiembrie 2017 15:30:49
Problema Heapuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.65 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(v[poz-1]);

       }
else {
    it=heap.begin();
    out << * it << '\n';
}

  }



    return 0;
}