Cod sursa(job #2263277)
| Utilizator | Data | 18 octombrie 2018 15:59:19 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 40 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.67 kb |
#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;
}
