Untitled
unknown
plain_text
22 days ago
562 B
2
Indexable
Never
int quer(int &l,int &r,int &xx,int id=0,int ns=0,int ne=1e6) { if (ns>xx) return -1e9; if (tree[id]>=l) return -1e9; if (ns==ne) { return ns; } int left=2*id+1,right=left+1; int md=(ns+ne)/2; if (tree[right]<l && ne<=xx) { return quer(l,r,xx,right,md+1,ne); } if (tree[right]>=l) { return quer(l,r,xx,left,ns,md); } return max(quer(l,r,xx,left,ns,md), quer(l,r,xx,right,md+1,ne)); }
Leave a Comment