PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#BS0000432. Qua lối đi hẹp (Fatman)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Qua lối đi hẹp (Fatman)

Fatman

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

A person wants to travel from the left end of an aisle to the right end despite the obstacles scattered inside it. Viewed from above, the person is modeled as a rigid disk, while each obstacle is an infinitesimally small point.

The aisle has length LL and width WW. Two parallel walls run along the aisle at y=0y=0 and y=Wy=W. There are NN obstacles, with obstacle ii at (Xi,Yi)(X_i,Y_i) inside or on the boundary of the aisle. The person can change direction freely, but the disk must not cross a wall or an obstacle. A disk of diameter dd cannot pass between two obstacles whose distance is less than dd. The same clearance is required between an obstacle and a wall. Contact with a wall or obstacle is allowed.

Find the largest disk diameter that still permits travel from the left end of the aisle to the right end.

The following diagram shows the obstacle positions in the example.

Aisle and obstacles

Input

The first line contains two integers L,WL,W, the length and width of the aisle.

The second line contains an integer NN, the number of obstacles.

Each of the next NN lines contains two integers Xi,YiX_i,Y_i, the coordinates of obstacle ii (1≤i≤N1\le i\le N).

Output

Print one line in the format Maximum size in test case 1 is M. replacing M with the largest possible diameter rounded to exactly four digits after the decimal point. Preserve capitalization, spaces and the final period.

Subtasks

  • Subtask 1 (20 points): 0≤L,W≤1000\le L,W\le100; 0≤N≤100\le N\le10; 0≤Xi≤L0\le X_i\le L, 0≤Yi≤W0\le Y_i\le W for all 1≤i≤N1\le i\le N.
  • Subtask 2 (30 points): 0≤L,W≤1000\le L,W\le100; 0≤N≤1000\le N\le100; 0≤Xi≤L0\le X_i\le L, 0≤Yi≤W0\le Y_i\le W for all 1≤i≤N1\le i\le N. All obstacles have the same xx-coordinate.
  • Subtask 3 (50 points): 0≤L,W≤1000\le L,W\le100; 0≤N≤1000\le N\le100; 0≤Xi≤L0\le X_i\le L, 0≤Yi≤W0\le Y_i\le W for all 1≤i≤N1\le i\le N.

Examples

Input

8 5
8
2 1
1 3
3 2
4 4
5 3
6 4
7 2
7 1

Output

Maximum size in test case 1 is 2.2361.

Explanation

The aisle is five units wide and eight units long, with eight obstacles. The relevant clearances are distances between obstacles and distances from obstacles to each wall.

For diameters at most 5\sqrt{5}, gaps of width 5\sqrt{5} remain passable. The obstacles connected to the lower wall through gaps strictly smaller than 5\sqrt{5} are (2,1),(3,2),(7,1),(7,2)(2,1),(3,2),(7,1),(7,2); the others are near the upper wall. No gap between the two groups is strictly smaller than 5\sqrt{5}, so there is no blocking chain across the aisle.

For any diameter greater than 5\sqrt{5}, the obstacles (2,1),(3,2),(5,3)(2,1),(3,2),(5,3) form a blocking chain between the walls. Its successive gaps have widths 11, 2\sqrt{2}, 5\sqrt{5} and 22. They are all smaller than the diameter, making the chain impassable.

The greatest diameter is 5=2.236067…\sqrt{5}=2.236067\ldots, which rounds to 2.2361.