Cod sursa(job #721907)
| Utilizator | Data | 24 martie 2012 13:25:08 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.5 kb |
#include <stdio.h>
#include <set>
#include <vector>
using namespace std;
multiset<int>heap;
vector<int>pos(1);
int main(){
int n,cod,x;
freopen("heapuri.in","r",stdin);
freopen("heapuri.out","w",stdout);
scanf("%d",&n);
while(n-->0){
scanf("%d",&cod);
if(cod==3){
printf("%d\n",*heap.begin()); } else {
scanf("%d",&x);
if(cod==1){
pos.push_back(x);
heap.insert(x); } else
heap.erase(heap.find(pos[x])); } }
}
