Hii…
I am doing this question from codeforces…
This is the question…
https://codeforces.com/problemset/problem/1341/B
I have solved this …pretty much with good logic… But it is showing wrong answer on test case - 2;
This is the solution…
https://codeforces.com/contest/1341/submission/97154154
Please look into this…
Thanks
Getting wrong answer
Hey @ashishnnnnn
Mentioned the changes in comments : https://ide.codingblocks.com/s/365044
If this resolves your query then please mark it as resolved
Here … what and how you have used… i+k-2…
Can you explain this a bit…
So for segment l to l+k-1 we dont have to consider extremes that is l and l+k-1
So peaksum[ l+k-2 ] contains peaks till that point and peaksum[l] containts peaks till l
Subtracting both will give peaks from l+1 to l+k-2 which is required
Yaa… Thanks…
Got THIS
1 Like