Cod sursa(job #496436)
| Utilizator | Data | 28 octombrie 2010 23:04:51 | |
|---|---|---|---|
| Problema | Heapuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.57 kb |
#include <stdio.h>
#include <set>
using namespace std;
int q,a[200002],n,x,i,c;
bool ok;
set<int> geo;
int main(){
freopen("heapuri.in","r",stdin);
freopen("heapuri.out","w",stdout);
scanf("%d",&n);
q=0;
ok=true;
for (i=0; i<n; i++){
scanf("%d",&c);
if (c==1 || c==2) scanf("%d",&x);
if (c==1){
q++;
a[q]=x;
geo.insert(x);
ok=true;
}
else
if (c==2) geo.erase(a[x]);
else
if (c==3) {
printf("%d\n",*geo.begin());
ok=false;
}
}
return(0);
}
