HBC200179Colorful Tree题解

上官魅 算法基础篇 55 0
想要检验自己的编程水平?来试试全网最全C++题库,让您在挑战中不断进步。
A tree structure with some colors associated with its vertices and a sequence of commands on it are given. A command is either an update operation or a query on the tree. Each of the update operations changes the color of a specied vertex, without changing the tree structure. Each of the queries asks the number of edges in the minimum connected subgraph of the tree that contains all the vertices of the specied color.Your task is to nd answers of each of the queries, assuming that the commands are performed in the given order.

A tree structure with some colors associated with its vertices and a sequence of commands on it are given. A command is either an update operation or a query on the tree. Each of the update operations changes the color of a specified vertex, without changing the tree structure. Each of the queries asks the number of edges in the minimum connected subgraph of the tree that contains all the vertices of the specified color. Your task is to find answers of each of the queries, assuming that the commands are performed in the given order.

HBC200179Colorful Tree题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)

标签: HBC200179Colorful Tree题解