Wa in bridges (dp)

my code should not give wa as it is logically correct as well as giving correct output offline.
but my code is giving wa online ,i can’t think why?

@mohitbiddu1 can you tell what exactly you do in LIS?

i have stored the both sides points in a struct and sorted in non dec order based on first row points and then i find lis on second row which will be required answer.

Yes the approach is right!
try this test
1
4
0 2 1 1
1 4 4 3
answer should be 4 but your output is 3.

thanks for the test case.
Gotcha!