Pagini recente » Cod sursa (job #639102) | Cod sursa (job #398292) | Cod sursa (job #3140243) | Cod sursa (job #2885801) | Cod sursa (job #2672132)
#include <fstream>
#include <set>
using namespace std;
ifstream fin ("heapuri.in");
ofstream fout ("heapuri.out");
int n, poz[200001], c, t, a, p, dim;
set < int > heap;
int main()
{
fin >> t;
for (int tt = 1; tt <= t; tt++) {
fin >> c;
if (c == 1) {
fin >> a;
poz[++dim] = a;
heap.insert (a);
}
else
if (c == 2) {
fin >> p;
heap.erase (poz[p]);
}
else
fout << *heap.begin () << '\n';
}
return 0;
}