Notice: Undefined index: AOJ_user_id in /home/judge/src/web/JudgeOnline/problem.php on line 27

Notice: Undefined offset: 0 in /home/judge/src/web/JudgeOnline/problem.php on line 28

Notice: Trying to access array offset on value of type null in /home/judge/src/web/JudgeOnline/problem.php on line 29

Notice: Trying to access array offset on value of type null in /home/judge/src/web/JudgeOnline/problem.php on line 30

Notice: Trying to access array offset on value of type null in /home/judge/src/web/JudgeOnline/problem.php on line 31

Notice: Trying to access array offset on value of type null in /home/judge/src/web/JudgeOnline/problem.php on line 32

Notice: Undefined offset: 0 in /home/judge/src/web/JudgeOnline/problem.php on line 35

Notice: Trying to access array offset on value of type null in /home/judge/src/web/JudgeOnline/problem.php on line 36

Notice: Undefined offset: 0 in /home/judge/src/web/JudgeOnline/problem.php on line 40

Notice: Trying to access array offset on value of type null in /home/judge/src/web/JudgeOnline/problem.php on line 41

Notice: Trying to access array offset on value of type null in /home/judge/src/web/JudgeOnline/problem.php on line 42

Notice: Trying to access array offset on value of type null in /home/judge/src/web/JudgeOnline/problem.php on line 43

Notice: Trying to access array offset on value of type null in /home/judge/src/web/JudgeOnline/problem.php on line 44

Notice: Undefined offset: 0 in /home/judge/src/web/JudgeOnline/problem.php on line 48

Notice: Trying to access array offset on value of type null in /home/judge/src/web/JudgeOnline/problem.php on line 49

Notice: Undefined offset: 0 in /home/judge/src/web/JudgeOnline/problem.php on line 53

Notice: Trying to access array offset on value of type null in /home/judge/src/web/JudgeOnline/problem.php on line 54

Notice: Trying to access array offset on value of type null in /home/judge/src/web/JudgeOnline/problem.php on line 55

Notice: Trying to access array offset on value of type null in /home/judge/src/web/JudgeOnline/problem.php on line 56

Notice: Undefined offset: 0 in /home/judge/src/web/JudgeOnline/problem.php on line 59

Notice: Trying to access array offset on value of type null in /home/judge/src/web/JudgeOnline/problem.php on line 60

Notice: Undefined offset: 0 in /home/judge/src/web/JudgeOnline/problem.php on line 65

Notice: Trying to access array offset on value of type null in /home/judge/src/web/JudgeOnline/problem.php on line 66

Notice: Trying to access array offset on value of type null in /home/judge/src/web/JudgeOnline/problem.php on line 67

Notice: Trying to access array offset on value of type null in /home/judge/src/web/JudgeOnline/problem.php on line 68

Notice: Undefined offset: 0 in /home/judge/src/web/JudgeOnline/problem.php on line 71

Notice: Trying to access array offset on value of type null in /home/judge/src/web/JudgeOnline/problem.php on line 72
3292:医院设置
Problem 3292 --医院设置

3292: 医院设置

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $0$ 正确数量 $0$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签
设有一棵二叉树(如下图),其中圈中的数字表示结点中居民的人口,圈边上数字表示结点编号。现在要求在某个结点上建立一个医院,使所有居民所走的路程之和为最小,同时约定,相邻结点之间的距离为11。就本图而言,若医院建在11处,则距离和=4+12+2×20+2×40=136;若医院建在33处,则距离和=4×2+13+20+40=81……


第一行一个整数n,表示树的结点数(n≤100)。接下来的n行每行描述了一个结点的状况,包含三个整数,整数之间用空格(一个或多个)分隔,其中:第一个数为居民人口数;第二个数为左链接,为0表示无链接;第三个数为右链接,为0表示无链接。
一个整数,表示最小距离和。
5
13 2 3
4 0 0
12 4 5
20 0 0
40 0 0
81

推荐代码 查看3292 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$ $ms]
内存最少[$ $KB]
第一AC
第一挑战

赛题来源/所属竞赛 最短路径算法 N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛
AOJ