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

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

Hello everyone, can you help me with this problem:

Given a tree has N vertice (N <= 3*10^5) and a number K (K <= n — 1). Each edge in this tree has a weight W (- 10^6 <= W <= 10^6).

You should choose exactly K edges that the sum of their weight is maximum and mustn't choose 2 edges that connect with the same vertex.

I think with N and K small, this problem can be solved using dp.

Thanks!

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

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

A very wild guess, but I'd try to think if aliens trick (aka Lagrange multipliers) works here.