Cod sursa(job #866905)
| Utilizator | Data | 28 ianuarie 2013 21:26:38 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.75 kb |
#include <fstream>
#include <vector>
#include <set>
using namespace std;
ifstream f("heapuri.in");
ofstream g("heapuri.out");
int n,cod,x;
set < int > Heap;
vector < int > V;
int main(){
int k=0;
f >> n;
V.resize(n+1);
for(int i=1;i<=n;i++){
f >> cod;
if(cod == 1){
f >> x;
V[++k] = x;
Heap.insert(x);
}
if(cod == 2){
f >> x;
Heap.erase(V[x]);
}
if(cod == 3)
g << *Heap.begin() << '\n';
}
f.close();
g.close();
return 0;
}
