Pagini recente » Cod sursa (job #1240300) | Cod sursa (job #2069424) | Cod sursa (job #3179750) | Cod sursa (job #2149942) | Cod sursa (job #2717897)
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#include <fstream>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
const int NMAX = 200005;
multiset<int>st;
int v[NMAX];
int cnt = 0;
int main()
{
ios_base::sync_with_stdio(false);
fin.tie(0); fout.tie(0);
int t;
fin >> t;
while (t--)
{
int op;
fin >> op;
if (op == 1)
{
int x;
fin >> x;
v[++cnt] = x;
st.insert(x);
}
else if (op == 2)
{
int x;
fin >> x;
st.erase(st.find(v[x]));
}
else
{
fout << *(st.begin()) << '\n';
}
}
return 0;
}