66B - Petya and Countryside Submission: 155219826
My idea was the same as the editorial:
Simulate the rain on all the blocks.
First I simulate the rain on the blocks indexed at 1 to n-2.
Then I simulate the rain on blocks indexed at 0 and n-1.
I update the maximum if necessary.
But I am still failing test cast 53.
Why is that?
You referred to a different problem
Hey, i got you. You are always getting the nearest value from where you are pouring the water so for example in this test case when you pour water on the 2, it ignores the 5s and goes onto the ones, i have the fixdown here
The test case
Should get 5 but your script gets 7
The submitted modified sol: 155226146 Hope it helps, bye.
i get it now, thanks a lot
More than that you can omit that explicit check of neighboring elements and make a while loop over all elements on the right and on the left as it is implemented here: 155226859 It helps to avoid such unpredictable mistakes