Cod sursa(job #2129080)
| Utilizator | Data | 12 februarie 2018 14:47:45 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.63 kb |
#include <iostream>
#include <vector>
#include <set>
#include <fstream>
using namespace std;
ifstream fin("heapuri.in");
ofstream fout("heapuri.out");
int main(){
set < int > heap;
vector < int > ord(1);
int n, o , x;
fin>>n;
while(n --){
fin>>o;
switch(o){
case 1:
fin>>x;
ord.push_back(x);
heap.insert(x);
break;
case 2:
fin>>x;
heap.erase(heap.find(ord[x]), heap.end());
break;
default:
fout<<*heap.begin()<<"\n";
break;
}
}
return 0;
}
