logo AlgoBeat OnlineJudge
登录 注册

#101908. [BZOJ 1908] Pku2054 Color a Tree

内存限制:64 MiB 时间限制:1000 ms 标准输入输出
题目类型:传统 评测方式:文本比较
上传者: 匿名

题目描述

输入格式

The input consists of several test cases. The first line of each case contains two integers N and R (1

输出格式

For each test case, output a line containing the minimum total coloring cost required for Bob to color all the nodes.

样例

样例输入

5 1
1 2 1 2 4
1 2
1 3
2 4
3 5
0 0

样例输出

33