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

建议使用的浏览器:

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

2187:Beauty Contest

题目描述
Bessie, Farmer John's prize cow, has just won first place in a bovine beauty contest, earning the title 'Miss Cow World'. As a result, Bessie will make a tour of N (2 <= N <= 50,000) farms around the world in order to spread goodwill between farmers and their cows. For simplicity, the world will be represented as a two-dimensional plane, where each farm is located at a pair of integer coordinates (x,y), each having a value in the range -10,000 ... 10,000. No two farms share the same pair of coordinates.

Even though Bessie travels directly in a straight line between pairs of farms, the distance between some farms can be quite large, so she wants to bring a suitcase full of hay with her so she has enough food to eat on each leg of her journey. Since Bessie refills her suitcase at every farm she visits, she wants to determine the maximum possible distance she might need to travel so she knows the size of suitcase she must bring.Help Bessie by computing the maximum distance among all pairs of farms.

输入解释
* Line 1: A single integer, N

* Lines 2..N+1: Two space-separated integers x and y specifying coordinate of each farm
输出解释
* Line 1: A single integer that is the squared distance between the pair of farms that are farthest apart from each other.
输入样例
4
0 0
0 1
1 1
1 0
输出样例
2
提示
Farm 1 (0, 0) and farm 3 (1, 1) have the longest distance (square root of 2)

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

题目来源 USACO 2003 Fall

源链接: POJ-2187

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

共提交 0

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