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

Автор aajjbb, 13 лет назад, По-английски

Hello everybody; I've been dealing with this problem about a time, but I can't understand what the pretest 2 stands about. take a Look;

Test 2:

7

10 4 6 3 2 8 15

The problem statement says that the displeasure of the i-th walrus is the number if younger walrus between i and the index of the further walrus who has an age less than the age of the _i_th walrus;

On this example take the walrus with age '4', the furthers walrus which is younger than him is the walrus with age 2; this closed interval is about (0-based) 2-3 which are walrus with age 6 and 3, only the walrus with age 3 is younger than walrus with age for. In my mind this result should be:

4 1 1 0 -1 -1 -1 instead of: 4 2 1 0 -1 -1 -1

can someone help me to figure out what is wrong ?

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

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

The displeasure of the i-th walrus is equal to the number of walruses between him and the furthest walrus ahead of him, which is younger than the i-th one.

The next sentence clears it up.

That is, the further that young walrus stands from him, the stronger the displeasure is.

And those walrus between the current and the younghest aren't neccessarily younger.

Although, I see a problem with "... As and B which is C". In your reading of the statement it would be "... As and B which are C".

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

    yes, it has cleared me a little, but if you count the number of younger walrus ahead of the the number 4 (index 1(0-based)), the further walrus younger than him is the 4-th one(number 2), and the walrus which are younger than 4 within this interval are just 1, and not 2;

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

      Obviously, I wasn't clear either.

      You should count all walrus between the current and the youngest.