Cod sursa(job #2721904)
| Utilizator | Data | 12 martie 2021 13:46:33 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.53 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
const int NMAX = 200005;
int n,operatie,poz[NMAX],x,k;
set <int> s;
int main()
{
fin >> n;
for(int i=1;i<=n;i++){
fin >> operatie;
if(operatie==3){
fout << *s.begin() << '\n';
continue;
}
fin >> x;
if(operatie==1){
s.insert(x);
poz[++k]=x;
}
if(operatie==2) s.erase(poz[x]);
}
return 0;
}
