7974: Moocast

内存限制:128 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:20 通过:12

题目描述


农夫约翰的 N 头奶牛想要建立一个紧急的奶牛广播系统,在它们之间广播重要信息。

奶牛们决定采用对讲机来进行沟通,因此,每头奶牛都需要配备一个对讲机。

每个对讲机都具有有限的信息传输半径,但是奶牛们可以通过互相帮忙传话的方式实现远距离沟通,因此,不必使每头奶牛都能与其他奶牛进行直接沟通。

奶牛们需要决定在对讲机上的花费,如果它们的花费为 X,则每头牛都可以配置一个传输半径为 √x  的对讲机。

也就是说,当两个奶牛之间的距离的平方不超过 X 时,这两头奶牛才能利用对讲机直接进行沟通。

请帮助奶牛确定 X 的最小整数值,以使得任何两个奶牛之间都能够有效的进行沟通。

输入格式

第一行包含一个整数 N

接下来 N 行,每行包含两个整数 x y,表示一头奶牛所处位置的横纵坐标。

输出格式

输出一个整数,表示 X 的最小整数值。

数据范围

1≤N≤1000,

0≤x,y≤25000



Farmer John's NN cows (1≤N≤10001≤N≤1000) want to organize an emergency "moo-cast" system for broadcasting important messages among themselves.

Instead of mooing at each-other over long distances, the cows decide to equip themselves with walkie-talkies, one for each cow. These walkie-talkies each have a limited transmission radius, but cows can relay messages to one-another along a path consisting of several hops, so it is not necessary for every cow to be able to transmit directly to every other cow.

The cows need to decide how much money to spend on their walkie-talkies. If they spend $X, they will each get a walkie-talkie capable of transmitting up to a distance of X−−√X. That is, the squared distance between two cows must be at most XX for them to be able to communicate.

Please help the cows determine the minimum integer value of XX such that a broadcast from any cow will ultimately be able to reach every other cow.

INPUT FORMAT (file moocast.in):

The first line of input contains NN. The next NN lines each contain the xx and yy coordinates of a single cow. These are both integers in the range 0…25,0000…25,000.

OUTPUT FORMAT (file moocast.out):

Write a single line of output containing the integer XX giving the minimum amount the cows must spend on walkie-talkies.

SAMPLE INPUT:

4
1 3
5 4
7 2
6 1

SAMPLE OUTPUT:

17

Problem credits: Richard Peng

输入样例 复制


输出样例 复制