HBC209991GreetingsSouvenir题解

不可一世的小女人 算法基础篇 35 0
不断提升技能,才能在职场中立于不败之地!全网最全C++题库,助您成为编程领域的佼佼者。
Furthermore, there is a glittering diamond embedded in each node. is an arbitrarily chosen integer, and it lights up all nodes in the subtree of. be the number of nodes lit up by the diamond on node. You are to choose the colours of each diamond, and maximize the mex function of — that is, the smallest non-negative integer not appearing in — the set of shininess values of all diamonds.

Goodbye and farewell. Good and well. A rooted tree of n n nodes is given. Each node u u has a colour c_u c u ​ . Furthermore, there is a glittering diamond embedded in each node u u. Its colour d_u d u ​ is an arbitrarily chosen integer, and it lights up all nodes in the subtree of u u whose colour equals d_u d u ​ . Let k_u k u ​ be the number of nodes lit up by the diamond on node u u, and this diamond gets a shininess value of k_u cdot d_u k u ​ ⋅d u ​ . You are to choose the colours of each diamond, and maximize the mex function of — that is, the smallest non-negative integer not appearing in — the set of shininess values of all diamonds.

HBC209991GreetingsSouvenir题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断挑战自我,才能突破极限!全网最全C++题库,让您在编程道路上越走越远。

标签: HBC209991GreetingsSouvenir题解