#include #include #include #include #include using namespace std; #define N 100010 #define M 260010 typedef long long LL; struct node{ LL x,y; int id; }w[150010]; LL ty[150010],ans[100010]; int ny; struct Tree{ int l,r; LL val; }tree[1050010]; bool cmp1(const node &a,const node &b){ if(a.x!=b.x) return a.xb.y; return a.idb.x; if(a.y!=b.y) return a.yb.x; if(a.y!=b.y) return a.y>b.y; return a.id>1; if(ty[mid]y) r=mid-1; else return mid+1; } } void build(int L,int R,int x){ tree[x].l=L; tree[x].r=R; tree[x].val=1000000000000; if(L==R) return ; int mid=(L+R)>>1; build(L,mid,x<<1); build(mid+1,R,x<<1|1); } LL find(int L,int R,int x){ if(tree[x].l>=L&&tree[x].r<=R) return tree[x].val; int mid=(tree[x].l+tree[x].r)>>1; if(R<=mid) return find(L,R,x<<1); if(L>mid) return find(L,R,x<<1|1); return min(find(L,mid,x<<1),find(mid+1,R,x<<1|1)); } void update(int id,int x,LL val){ if(tree[x].l==tree[x].r){ tree[x].val=min(tree[x].val,val); return ; } int mid=(tree[x].l+tree[x].r)>>1; if(id<=mid) update(id,x<<1,val); else update(id,x<<1|1,val); tree[x].val=min(tree[x<<1].val,tree[x<<1|1].val); } int main(){ int n,q,cs=0; while(scanf("%d",&n)&&n!=-1){ if(cs) printf("\n"); else cs=1; for(int i=0;i