Cod sursa(job #2939580)
| Utilizator | Data | 13 noiembrie 2022 22:02:11 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.64 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
const int NMAX = 200005;
int v[NMAX], n, k;
set<int>s;
vector<int>idx;
int main()
{
fin >> n;
for(int i=1;i<=n;++i)
{
int x, y;
fin >> x;
if(x == 1)
{
fin >> y;
v[++k] = y;
s.insert(y);
}
else if(x == 2)
{
fin >> y;
s.erase(v[y]);
}
else if(x == 3)
{
idx.push_back(*s.begin());
}
}
for(auto x : idx)
fout << x << '\n';
}
