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

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

Hello all. I am currently having trouble understanding the DP approach to solving problem 452D. I have read a few of the solutions but I fail to understand why they work.

Thanks in advance. :)

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

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

nobody cares

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

    Wow, what an asshole, Bredor. Taco, I really hope you aren't put off of the entire community because of people like him. Personally, I didn't actually use a DP, I went with a greedy. Would you like me to explain that one or are you going for the DP specifically? BTW, as a fellow fan of tacos al pastor, nice username. :)

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

Well the idea is quite simple, since k = 10^4 and there are only 3 thing to do you can simulate all the process, you just need to store the time where each laundry piece is ready w[] and the time where each machine is ready time_m[]. At the beginning each w[] and time_w[] will be 0, Now for each process wash,dry,fold (lets index with j) the time where the i-th piece of laundry is ready is after the piece is ready or the machine that will serve this piece (which is i%n[j]) is ready plus the time to be served, I mean w[i] = time_m[i%n[j]] = max(time_m[i%n[j]],w[i])+t[j]. Finally the answer is the max element of w, which is w[k]. Hope I have explained it clearly. my submission during contest