pistone's blog

By pistone, 12 years ago, In English

there are 10000 stations numbered from 0 to 9999. from each station , some load has to be transferred to another station by train . the fuel consumption of train between 2 successive station is 1 litre .

Find the minimum amount of fuel , in which loads can be transferred to all the destination stations.

constraints: the load for each station is between 1 and 100 inclusive. a train cannot carry more than 50 kgs of load at one time. a train cannot carry loads of several stations at the same time even if it can take more load . several stations can send their load to a station at the same time.

the first train leaves station 0.

Input : the destination station and load to be transferred for each of the 10000 stations.

need help in solving this problem

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

»
12 years ago, # |
  Vote: I like it +11 Vote: I do not like it

Please provide link to the problem, in the opposite case you can be cheater.

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

    hi , this was already asked in my company's internal programming contest. i couldnt solve it