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

Автор harry_porter_7, история, 10 лет назад, По-английски

Given a list of coordinates x1, x2, ..... xn, and each of coordinates has a value time t1, t2, ... tn. U can start at anywhere in the ox axis, u have to find the smallest time to reach all the points x1, x2... xn, and u also have to reach every points in the time of that point, meaning that assume at time t u reach xk point, so t<=tk. Output the smallest time or "No solution".

please help me this problem xD P/s: link this problem :D Your text to link here...

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

»
10 лет назад, скрыть # |
Rev. 3  
Проголосовать: нравится +3 Проголосовать: не нравится

The idea is as follows. Let's enumerate all treasures from the leftmost to the rightmost. Note that there are not so many states of interest, and it allows us to use DP approach. Let dp0(l, r) be the time that is needed to collect all the treasures between l and r and end up in the treasure l (in the left border), Similarly, let dp1(l, r) be the time that is needed to collect all the treasures between l and r and end up in the treasure r (in the right border). Now try to find how to calculate dp1(l, r) and dp0(l, r) based on calculated values dp0 and dp1 for ranges with a smaller length.

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

Hello, but can i ask u some about your answer? XDXD i dont see it correctly cause i have some little questions that. if the answer for i..j interval is from i+1,j,0 and i,j-1,1 right? so if have a path from middle of i,j like i-1<k<j-1(meaning we travel from k to i. not i to i+1) so i think that dp is not good! can u explain for me some? Thank you many XD