Would you please help me with a Nowcoder problem?

Правка en1, от Aveiro_quanyue, 2023-03-28 06:31:16

A tree $$$T=(V, E)$$$ has $$$n$$$ vertices and $$$n-1$$$ edges, the weight of each vertex $$$i$$$ is $$$a_i$$$.

For each edge $$$e$$$, you can determine its direction, i.e., for two vertices $$$u, v$$$, there are two states: $$$u \rightarrow v$$$ and $$$v \rightarrow u$$$. There are $$$2^{n-1}$$$ states in total.

For each state $$$S$$$, we define $$$f(S)$$$ as

$$$f(S) := \sum\limits_{(u, v) \in V \times V, v is reachable from u} |a_u - a_v|$$$

Теги tree, contribution

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en11 Английский Aveiro_quanyue 2023-03-28 07:06:04 63
en10 Английский Aveiro_quanyue 2023-03-28 06:56:17 0 (published)
en9 Английский Aveiro_quanyue 2023-03-28 06:56:12 14 (saved to drafts)
en8 Английский Aveiro_quanyue 2023-03-28 06:41:15 7 Tiny change: 'b.png)\n\nThe constraint: $2 \leq ' -> 'b.png)\n\nConstraints: $2 \leq '
en7 Английский Aveiro_quanyue 2023-03-28 06:39:25 0 (published)
en6 Английский Aveiro_quanyue 2023-03-28 06:39:08 62 (saved to drafts)
en5 Английский Aveiro_quanyue 2023-03-28 06:38:09 0 (published)
en4 Английский Aveiro_quanyue 2023-03-28 06:38:02 55
en3 Английский Aveiro_quanyue 2023-03-28 06:37:33 10
en2 Английский Aveiro_quanyue 2023-03-28 06:37:04 612
en1 Английский Aveiro_quanyue 2023-03-28 06:31:16 462 Initial revision (saved to drafts)