Блог пользователя fishcurry

Автор fishcurry, история, 2 года назад, По-английски

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?

  • Проголосовать: нравится
  • -14
  • Проголосовать: не нравится

»
2 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

You referred to a different problem

»
2 года назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

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.

  • »
    »
    2 года назад, # ^ |
      Проголосовать: нравится +1 Проголосовать: не нравится

    i get it now, thanks a lot

    • »
      »
      »
      2 года назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      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