Cod sursa(job #963446)

Utilizator mvcl3Marian Iacob mvcl3 Data 17 iunie 2013 15:17:22
Problema Heapuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.73 kb
#include <fstream>
#include <set>
#define max_size 200009
using namespace std;

ifstream f("heapuri.in");   ofstream g("heapuri.out");

int t, tip, x, count, poz[max_size];
set <int> Heap;

int main()
{
    f >> t;

    while(t --)
    {
        f >> tip;

        switch(tip)
        {
            case 1:
            {
                f >> x;
                poz[++count] = x;
                Heap.insert(x);
                break;
            }
            case 2:
            {
                f >> x;
                Heap.erase(poz[x]);
                break;
            }
            case 3:
            {
                g << (*Heap.begin()) << '\n';
                break;
            }
        }
    }

    g.close();
    return 0;
}