当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2137:Cowties

题目描述
N cows (3 <= N <= 100) are eating grass in the middle of a field. So that they don't get lost, Farmer John wants to tie them together in a loop so that cow i is attached to cows i-1 and i+1. Note that cow N will be tied to cow 1 to complete the loop.

Each cow has a number of grazing spots she likes and will only be happy if she ends up situated at one of these spots. Given that Farmer John must ensure the happiness of his cows when placing them, compute the shortest length of rope he needs to tie them all in a loop. It is possible for different parts of the loop to cross each other.
输入解释
* Line 1: The integer N.

* Lines 2..N+1: Each line describes one cow using several space-separated integers. The first integer is the number of locations S (1 <= S <= 40) which are preferred by that cow. This is followed by 2*S integers giving the (x,y) coordinates of these locations respectively. The coordinates lie in the range -100..100.
输出解释
A single line containing a single integer, 100 times the minimum length of rope needed (do not perform special rounding for this result).
输入样例
4
1 0 0
2 1 0 2 0
3 -1 -1 1 1 2 2
2 0 1 0 2
输出样例
400
提示
[Cow 1 is located at (0,0); cow 2 at (1,0); cow 3 at (1,1); and cow 4 at (0,1).]

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-2137

最后修改于 2020-10-29T06:24:19+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536