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

#BS0000449. Trứng Phục Sinh (Easter Eggs)

    ID: 3574 Loại: Thông thường 4000ms 256MiB Tried: 0 Đã chấp nhận: 0 Độ khó: 1 Đăng bởi: Nhãn>Binary search on answerBipartite matchingKuhn algorithmDistance functionsFloating point arithmetic
HỌC THEO LỘ TRÌNH

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

1 lộ trình

Trứng Phục Sinh (Easter Eggs)

Easter Eggs

Source: Kattis

Version: Phuoc Hung OJ Extended

Problem Statement

An Easter egg hunt uses BB blue bushes and RR red bushes. A blue egg may only be placed at a blue bush, and a red egg at a red bush. At most one egg fits at each bush. Place exactly NN eggs, choosing the number of each colour freely. The score is the smallest Euclidean distance between a selected blue bush and a selected red bush. Maximise this score. Since B<NB<N and R<NR<N, both colours must occur.

Input

The first line contains integers N,B,RN,B,R. The next BB lines give integer coordinates x,yx,y of the blue bushes, followed by RR lines of red bush coordinates.

Output

Print the maximum score as a real number with absolute error at most 10−610^{-6}. Use at least six decimal digits for sufficient precision.

Subtasks

  • Subtask 1 (20 points): 2≤N≤2502\le N\le250, 1≤B,R<N1\le B,R<N, N≤B+R≤16N\le B+R\le16; −104≤x,y≤104-10^4\le x,y\le10^4; all coordinates are integer and all B+RB+R points are distinct.
  • Subtask 2 (30 points): 2≤N≤2502\le N\le250, 1≤B,R<N1\le B,R<N, N≤B+R≤100N\le B+R\le100; −104≤x,y≤104-10^4\le x,y\le10^4; all coordinates are integer and all B+RB+R points are distinct.
  • Subtask 3 (50 points): 2≤N≤2502\le N\le250, 1≤B,R<N1\le B,R<N, N≤B+RN\le B+R; −104≤x,y≤104-10^4\le x,y\le10^4; all coordinates are integer and all B+RB+R points are distinct.

Examples

Input 1

3 2 2
0 0
1 0
2 0
3 0

Output 1

2.000000000000000

Explanation 1

Choose both blue bushes and red bush (3,0)(3,0). The minimum is 2. Above 2 only the cross-colour pair (0,0),(3,0)(0,0),(3,0) is possible, so three eggs cannot be placed.

Input 2

4 3 3
0 0
1 2
-1 2
0 1
-1 -1
1 -1

Output 2

3.000000000000000

Explanation 2

Select the four bushes (1,2),(−1,2),(−1,−1),(1,−1)(1,2),(-1,2),(-1,-1),(1,-1). The two vertical pairs have distance 3. Above 3 neither central bush can coexist with any opposite-colour bush, and both vertical pairs are forbidden. Four selections are impossible.

Example 2