Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

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

Автор woolgatherer, история, 2 года назад, По-английски

Here in this problem problem it is said that for n jobs, given is the base price p for each job and an extra charge s for every pair of jobs (i, j), meaning that you have to pay additional s for job i, if and only if job j was completed before, you are to compute the minimum total costs needed to finish all jobs. constraint: 1 <= tc <= 100, 1 <= n <= 14 and base price 1 <= p <= 100000. I noticed some people solved it in O(2^n * n^2) using bitmask dp. As n is 14 so the complexity is approximately 321426400(> 1e8) considering 100 tc as well. How come it passes in 1 sec? An AC Code

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

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

As I can see, n<=14. 14^2=196, 2^14=16384. So it's 10^6. Should pass with no problem. Or did I miss something?