Pagini recente » Cod sursa (job #1808526) | Cod sursa (job #2450301) | Cod sursa (job #2064635) | Cod sursa (job #1065768) | Cod sursa (job #2630224)
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
int n, x, op;
vector<int> f;
set<int> s;
set<int> :: iterator it;
int main()
{
ios::sync_with_stdio(false);
fin.tie(0);
fin >> n;
for (int i = 1; i <= n; ++i)
{
fin >> op;
if (op == 1)
{
fin >> x;
s.insert(x), f.push_back(x);
}
else if (op == 2)
{
fin >> x;
x = f[x - 1], s.erase(x);
}
else
it = s.begin(), fout << *it << "\n";
}
return 0;
}