Cod sursa(job #2626240)
| Utilizator | Data | 6 iunie 2020 12:44:57 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-32 | Status | done |
| Runda | Arhiva educationala | Marime | 0.71 kb |
#include <iostream>
#include<set>
#include<vector>
#include<fstream>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
set<int> m;
vector<int>v;
int main()
{
int n;
f >> n;
for(int i = 0; i < n; i++)
{
int op;
f >> op;
if(op == 1)
{
int x;
f >> x;
m.insert(x);
v.push_back(x);
}
else if(op == 2)
{
int x;
f >> x;
int el = v[x - 1];
m.erase(el);
}
else if(op == 3)
{
g << *m.begin() << "\n";
}
}
return 0;
}