aajjbb's blog

By aajjbb, 13 years ago, In English

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 ?

  • Vote: I like it
  • +4
  • Vote: I do not like it

»
13 years ago, # |
  Vote: I like it +5 Vote: I do not like it

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 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    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 years ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      Obviously, I wasn't clear either.

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