Radio Waves zoj 3370

来源:互联网 发布:淘宝亚马逊代拍 编辑:程序博客网 时间:2024/05/16 07:38
Radio Waves
Time Limit: 10 Seconds      Memory Limit: 32768 KB      Special Judge

It is well known, that radio waves interfere, so if two closely located radio transmitters use the same frequency, the quality of the programs is poor.

The company NateRadio is planning to transmit its programs in Flatland. The Ministry of Health and Communications has issued the license to the company that allows it to use two different frequencies for the transmission.

The company has n slots for radio transmitters located at different points of the country. However, the transmitters themselves are not yet bought. The managers of the company want to know what power the transmitters should be. The power of the transmitter affects the range it transmits the radio program to.

All transmitters will have the same power. Transmitters will be installed into the slots and each will be tuned to one of the two allowed frequencies. The power of the transmitters must be selected in such a way that the programs from no two transmitters tuned to the same frequency are simultaneously received at any point. Each slot must be used.

Since the company wants the programs to be received by most people, it wants to install as powerful transmitters as possible --- the range of the transmission must be maximal.

Input

The first line of the input file contains n --- the number of slots for the transmitters (3 ≤ n ≤ 1200). The following n lines contain two integer numbers each --- the coordinates of the corresponding slots. Coordinates do not exceed 104 by their absolute value. All slots are different.

There are multiple cases. Process to the end of file.

Output

On the first line of the output file print the maximal possible range of the transmitters. On the second line print n integer numbers --- for each transmitter slot print 1 if the transmitter in this slot must use the first frequency, or 2 if it must use the second one.

You answer must be accurate up to 10-6. All inaccurances under this level will be resolved in your favor.

Sample Input

40 00 11 01 1

Sample Output

0.707106781186547521 2 2 1

Author: Andrew Stankevich
Source: Andrew Stankevich's Contest #11

wa 无数次!
原因:(还记得的)
1.  high,low 对于solve成功与否的判断:
     ok 的话low=mid;       else  high=mid-1;
     mid>=high-1时跳出,在判断high是否满足……这样才能保证二分的距离正确。
2. bfs的判出条件,
   如果像开始那样while(num<n&&!(Q1.empty()&&Q2.empty())),那如果队列非空但是num>n咋办呢?!所以应该是while(!(Q1.empty()&&Q2.empty()))
其他错误错的不大有意义,在此不再赘述……