segment tree and D problem of ACL contest 2 
Difference between en1 and en2, changed 70 character(s)
Hello, codeforces↵
I was doing D of ACL contest 2 today. Before diving into the issue I want to specify that I know the basic use of segment tree, like finding max range query and update. It seemed to me similar with LIS. After scratching some time, I came up with segment tree idea. Here I am writing about my idea.↵

1. taking x as input↵
2. Finding the maximum range query of x-k to x+k i.e. maxh↵
3. updating the index of x with the value of maxh+1.↵
4. Atlast finding maximum range query from 1 to n↵

I am pretty sure that this method should solve this problem but in the contest, submission gave 6 correct and 26 wrong results. I want to know your feedback and suggestions.↵

I copied the code of the segment tree from gfg and modified as per the requirements. ↵
Here is my code [link](https://atcoder.jp/contests/abl/submissions/17046181)

Here is problem [link](https://atcoder.jp/contests/abl/tasks/abl_d)

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English biranchi 2020-09-26 17:02:10 70
en1 English biranchi 2020-09-26 17:00:44 893 Initial revision (published)