Pagini recente » Cod sursa (job #859425) | Cod sursa (job #1498397) | Cod sursa (job #1794780) | Cod sursa (job #2721468) | Cod sursa (job #2263277)
#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;
for(int i = 0; i < n; i++)
{
int c;
fin >> c;
if(c == 1)
{
int x;
fin >> x;
s.insert(x);
history.push_back(x);
}
else if (c == 2)
{
int x;
fin >> x;
s.erase(history[x - 1]);
}
else if (c == 3)
{
fout << *s.begin() << std::endl;
}
}
return 0;
}