Cod sursa(job #759246)
| Utilizator | Data | 17 iunie 2012 12:06:36 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.6 kb |
#include <cstdio>
#include <set>
#include <algorithm>
using namespace std;
#define MAX 200002
multiset<int>s;
multiset<int>::iterator it;
int v[MAX],n;
int main(){
int m,c,x;
freopen("heapuri.in","r",stdin);
freopen("heapuri.out","w",stdout);
scanf("%d",&m);
while(m--)
{
scanf("%d",&c);
switch(c){
case 1: scanf("%d",&x); v[++n]=x; s.insert(v[n]); break;
case 2: scanf("%d",&x); it=s.find(v[x]); s.erase(it); break;
case 3: printf("%d\n",*s.begin()); break;
}
}
return 0;
}
