Cod sursa(job #2056444)
Utilizator | Data | 4 noiembrie 2017 11:47:27 | |
---|---|---|---|
Problema | Heapuri | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.45 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
set <int> s;
int n,i,x,type,k,v[1000000];
int main() {
fin>>n;
for (int i=1; i<=n; ++i) {
fin>>type;
if (type==1) {
fin>>x;
s.insert(x);
v[++k]=x;
}
if (type==3) fout<<*s.begin()<<'\n';
if (type==2){fin>>x; s.erase(s.find(v[x]));}
}
return 0;
}