Pagini recente » Cod sursa (job #2638934) | Cod sursa (job #945085) | Cod sursa (job #1147535) | Cod sursa (job #2110986) | Cod sursa (job #2786821)
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("heapuri.in");
ofstream fout("heapuri.out");
const int dim=200009,nmax=200000,inf=1e9+9;
int aint[4*dim];
void build(int nod,int tl,int tr){
if(tl==tr){
aint[nod]=inf;
return;
}
int tm=(tl+tr)/2;
build(2*nod,tl,tm);
build(2*nod+1,tm+1,tr);
aint[nod]=min(aint[2*nod],aint[2*nod+1]);
}
void update(int nod,int tl,int tr,int pos,int val){
if(tl==tr){
aint[nod]=val;
return;
}
int tm=(tl+tr)/2;
if(pos<=tm)
update(2*nod,tl,tm,pos,val);
else
update(2*nod+1,tm+1,tr,pos,val);
aint[nod]=min(aint[2*nod],aint[2*nod+1]);
}
signed main(){
int q,n=0;
fin>>q;
build(1,1,dim-9);
while(q--){
int op;
fin>>op;
if(op==1){
int x;
fin>>x;
n++;
update(1,1,nmax,n,x);
}
if(op==2){
int x;
fin>>x;
update(1,1,nmax,x,inf);
}
if(op==3){
fout<<aint[1]<<'\n';
}
}
}