tempestDemise's blog

By tempestDemise, history, 3 years ago, In English

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?

  • Vote: I like it
  • -14
  • Vote: I do not like it

| Write comment?
»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

You referred to a different problem

»
3 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

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

9
1 1 1 5 2 5 1 1 1

Should get 5 but your script gets 7

The submitted modified sol: 155226146 Hope it helps, bye.

  • »
    »
    3 years ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    i get it now, thanks a lot

    • »
      »
      »
      3 years ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      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