manvscode's blog

By manvscode, history, 8 years ago, In English

in the problem Saghher And Nubian Market i am getting an awkward error. I am able to output a more optimal answer, than jury, don't know how is itiwrong (in test case 6) link to my submission. please help, am a newbie. they dont have to be consecutive, but do they have to be in order?

  • Vote: I like it
  • 0
  • Vote: I do not like it

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

If you are picking up three items then corresponding prices for the items would be

[4,3,2,1] =====>(Picking up 3 items)=====> [4+1*3,3+2*3,2+3*3,1+4*3]====>[7,9,11,13].

Your answer is 24 for 3 items. Which items would you pick to get 24 as an answer? Here the minimum you can get is 27 by picking up 7,9 and 11 so jury's answer is correct. You might have made some mistake in understanding the question statement.

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

You can't sort items. Item's price depends on the initial position. With sorting the problem is much easier