I knew the solution but thought dinic works in O(N^3) so never implemented . Forgot that its a unit graph.
Is this working for the samples ? I’m getting 14 14
Dude this isn’t passing the samples either
This is not working for increasing sequence , what should i change in binary search ?
Fails for
1
6
3 3 1 7 6 10
Correct output is 10 your code gives 7
No it is give correct answer on codehef compiler
Can anyone share the approach for jiggly puff ?? I tried greedy but got wa
That code was a little messed up, ignore it.
Yeah i thought of ford fulkerson but thought it might give tle
is binary search wrong approach ?
You can’t have an entirely increasing or an entirely decreasing sequence. The peak of the array should be from 2 → N-1, i.e. not at either 1 or N. Have you considered that ?
Did anyone solve 4th problem with a 2-D segment tree ? It was my first thought but then I thought it might TLE so I switched over to 2 one-D fenwicks.
i am checking for 1 but after applying condition for n it is giving wrong answer.
Did you get 10 for this test-case ?
after applying condition for N it again gives 7
Yeah print the variables at every step to see where’s it going wrong.
I guess 2D segment tree will be two large in memory and time.
Btw How to solve for large coordinates. -1e9 <= X , Y <= 1e9.