Cod sursa(job #1164477)

Utilizator UVS_Elfus_Deneo_KiraUVS-Elfus-Dutzul-Kira UVS_Elfus_Deneo_Kira Data 2 aprilie 2014 09:07:05
Problema Heapuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 1.02 kb
#include<fstream>
#include<cstdio>
#include<set>
#include<vector>
#include<algorithm>
#define FOR(a,b,c) for(int a=b;a<=c;++a)
#include<cstring>
#include<bitset>
#include<cmath>
#include<iomanip>
#include<queue>
#define f cin
#define g cout
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ll long long
#define bit 20
#define inf 500000000
#define base 256
#define ba 255
#define N 200100
#define mod  1999999973
#define inu "heapuri.in"
#define outu "heapuri.out"
using namespace std;
ifstream f(inu);
ofstream g(outu);
//int dx[]={0,0,0,1,-1};
//int dy[]={0,1,-1,0,0};
set<int> s;
int t,tip,n,x,ord[N];
int main ()
{
    f>>n;
    FOR(i,1,n)
    {
        f>>tip;
        if(tip==1)
        {
            f>>x;
            ord[++t]=x;
            s.insert(x);
        }
        if(tip==2)
        {
            f>>x;
            s.erase(ord[x]);
        }
        if(tip==3)
        {
            g<<*s.begin()<<"\n";
        }
    }
    return 0;
}