Cod sursa(job #932259)

Utilizator SPDionisSpinei Dionis SPDionis Data 28 martie 2013 19:55:57
Problema Heapuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.55 kb
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

using namespace std;
ifstream in("heapuri.in");
ofstream out("heapuri.out");

multiset<int> a;
vector<int> b;


int main()
{
    int n;
    in >> n;
    b.push_back(0);
    for (int i = 0; i < n; ++i)
    {
        int x,y; in >> x;
        if ( x == 1 ) { in >> y; b.push_back(y); a.insert(y); }
        if ( x == 2 ) { in >> y; a.erase( a.find(b[y]) ); }
        if ( x == 3 ) { out << *(a.begin()) << '\n'; }
    }
    return 0;
}