BAT3 - BATMAN3
" Bruce Wayne: I do fear death. I fear dying in here while my city burns.
Blind Prisoner: Then make the climb.
Bruce Wayne: How?
Blind Prisoner: As the child did. Without the rope. Then fear will find you again. "
The Epic fight between BANE and BATMAN saw BATMAN on the losing side .Bane delivers a crippling blow to Batman's back, then takes him to a foreign, well-like prison where escape is virtually impossible .
The prison as we know is a place from where no man ever escaped , except for the child of Ra's al Ghul himself .
The heroics of BATMAN saw him escape the prison , however after the prison came the Valleys . To reach the city , He needed to cross these valleys . Meanwhile , BANE's army has surrounded the city and trapped all the policemen underground . Each of these peaks contain exactly one policeman held captive by Bane's men. Since, BATMAN needs to build his own army , he decides to free some of the policemen on his way .
Also BATMAN needed to save his energy before his battle with Bane ,so he decided to take only downhill (strictly) jumps .Detective John Blake ( now called as ROBIN ) is standing in one of these peaks with a mini-BAT . This will allow BATMAN to take a maximum one jump uphill ahead . BATMAN can choose to flee ROBIN and use the BAT or rather cross over without his help .
The task in hand is to maximize the army strength to face BANE as BATMAN crosses over.
(BATMAN can take his first jump on any of these peaks)
" Bane : So, you came back to die with your city.
Batman : No. I came back to stop you. "
t , number of testcases
n : number of peaks , m : (zero based)index of the peak where ROBIN is standing
n intergers denoting the height of the peaks
The maximum strength of the army
Input:1 6 4 6 3 5 2 4 5Output:
For those who are getting WA batman does not need to cross the city you need to find max out of all endings not at the end of city , costed me 1 WA
Got 2 WA assuming Batman could use the mini-bat anytime after he had acquired it :(
It should be clearly stated the batman doesn't need to jump on the last peek. He has to get maximum possible policeman on his side that's all.
Nice logic! Also if it may help at all, batman can take the uphill jump only
After a series of dp!!First time AC in one go....
AC in 1 go:-)
easy one :)
@dush1729 @Dushyant Singh