Standard LIS DP is . The constraint that consecutive elements differ by at most doesn't reduce this with naive approach.
Example: , . Standard LIS checks all where . Still .
Segment tree: for element with value , query max LIS among values . Add for current element. Update segment tree at position . Each operation is .