Pagini recente » Cod sursa (job #2473995) | Cod sursa (job #2125544) | Cod sursa (job #3130801) | Cod sursa (job #1906492) | Cod sursa (job #2895372)
#include <fstream>
#include <set>
#include <vector>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
set<int> heap;
vector<int> poz;
int main()
{
poz.push_back(-1);
int N;
fin >> N;
for (int i = 0; i < N; ++i) {
int op;
fin >> op;
if (op == 3)
fout << *heap.begin() << '\n';
else {
int x;
fin >> x;
if (op == 1)
{heap.insert(x);
poz.push_back(x);}
else
heap.erase(poz[x]);
}
}
return 0;
}