Cod sursa(job #2737130)

Utilizator SlavicGGuzun Veaceslav SlavicG Data 4 aprilie 2021 14:26:15
Problema Heapuri Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 1 kb
#include "bits/stdc++.h"

using namespace std;
 
#define              ll              int
 
#define       forn(i,n)              for(int i=0;i<n;i++)
#define          all(v)              v.begin(), v.end()
#define         rall(v)              v.rbegin(),v.rend()
 
#define            pb                push_back
#define          sz(a)               (int)a.size()
#define         fastio               ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define      GR(a,n,m)               vector<vector<int>> a(n, vector<int>(m, 0));

ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
void solve()
{
	int q;
	fin >> q;
	vector<int> v;
	multiset<int> s;
	while(q--)
	{
		int type;
		fin >> type;
		if(type == 1)
		{
			int x;
			cin >> x;
			s.insert(x);
			v.pb(x);
		}
		if(type == 2)
		{
			int x;
			fin >> x;
			--x;
			s.erase(v[x]);
		}
		if(type == 3)
		{
			fout << (*s.begin()) << '\n';
		}
	}
}
 
int32_t main()
{
	//fastio;
    int t = 1;
   	//cin >> t;
   	while(t--)
   	{
   		solve();
   	}
}