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

Автор FlyingElephant, история, 13 месяцев назад, По-английски

Hi, I was trying to solve this problem and I am having hard times getting an accepted solutions. I tried a standard 0/1 knapsack approach iterating on the quantities of each book but got TLE on 5/10 test cases. I made some research and found this blog on CF in which this solution was provided but I am not able to figure out neither why the loop over j stops at H[i] nor the inner loop over l. It seems a very complicated approach. Also I've found this other approach which seems way easier but even in this case I am not able to clarify in my mind what is going on. If anybody could explain me how this works will be very apprecciated. In particular if u could also provide me some useful easier/similar problem which uses similar concept would be amazing. my submission

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

»
13 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

100*10^5 * 1000 = 10^10 cant pass in 1 second

»
13 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Try to answer this question — For a fixed number of pages P, what is the minimum cost ?