Pagini recente » redsnow_1 | Cod sursa (job #2566070) | Cod sursa (job #1617690) | Cod sursa (job #560718) | Cod sursa (job #2263278)
#include <fstream>
#include <vector>
#include <set>
#include <functional>
int main()
{
std::ifstream fin("heapuri.in");
std::ofstream fout("heapuri.out");
int n;
std::set<int> s;
std::vector<int> history;
fin >> n;
int x;
int c;
for(int i = 0; i < n; i++)
{
fin >> c;
if(c == 1)
{
fin >> x;
s.insert(x);
history.push_back(x);
}
else if (c == 2)
{
fin >> x;
s.erase(history[x - 1]);
}
else if (c == 3)
{
fout << *s.begin() << std::endl;
}
}
return 0;
}