Cod sursa(job #2535514)

Utilizator MihclerioVladimir Chim Mihclerio Data 31 ianuarie 2020 22:36:37
Problema Heapuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 1.1 kb
#pragma GCC optimize("Ofast")
/*
       /\__/\
      ( • - •)
        /  >🍪

  why hack me, better eat a cookie
*/
#include<bits/stdc++.h>

#define Plan_B() cout<<"HESOYAM"

#define all(s) s.begin(),s.end()
#define rc(x) return cout<<x,0

#define pb push_back
#define mp make_pair
#define fr first
#define sc second

typedef long long ll;

const ll nmax=2e5+3;
const ll mod=1e9+7;
const ll inf=2e9+3;

using namespace std;

#define DEBUG

int main()
{
#ifdef DEBUG
  freopen("heapuri.in","r",stdin);
  freopen("heapuri.out","w",stdout);
#endif
  mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
  ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);

  int t;
  cin>>t;
  set<int>s;
  int pos[nmax];
  int p=0;
  while(t--)
  {
    int c;
    cin>>c;
    if(c==1)
    {
      int k;
      cin>>k;
      s.insert(k);
      pos[++p]=k;
    } else
    if(c==2)
    {
      int k;
      cin>>k;
      s.erase(pos[k]);
    } else
    {
      cout<<*s.begin()<<"\n";
    }
  }

#ifdef DEBUG
  cout<<"\n";

#endif
}