Cod sursa(job #1046561)

Utilizator costyrazvyTudor Costin Razvan costyrazvy Data 3 decembrie 2013 09:22:43
Problema Heapuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.44 kb
#include <fstream>
#include <set>
using namespace std;
multiset <int> v;
int x,n,i,key,q,a[400005];
int main()
{
    ifstream f("heapuri.in");
    ofstream g("heapuri.out");
    f>>n;
    for (i=1;i<=n;i++)
      {
          f>>key;
          if (key==1) f>>x,v.insert(x),a[++q]=x;
          if (key==2) f>>x,v.erase(v.find(a[x]));
          if (key==3) g<<*v.begin()<<'\n';
      }
    f.close();
    g.close();
    return 0;
}