Cod sursa(job #2740102)
| Utilizator | Data | 11 aprilie 2021 14:45:08 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.74 kb |
#include <iostream>
#include <fstream>
#include <bits/stdc++.h>
using namespace std;
ifstream f ("heapuri.in");
ofstream g ("heapuri.out");
int main()
{
set<int> h;
int n;
f >> n;
vector<int> ordine;
for (int i = 1; i <= n; ++i)
{
int tip;
f >> tip;
switch(tip)
{
case 1:
{
int x;
f >> x;
h.insert(x);
ordine.push_back(x);
break;
}
case 2:
{
int x;
f >> x;
h.erase(ordine[x-1]);
break;
}
case 3:
g << *h.begin() << '\n';
break;
}
}
return 0;
}
