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

#BS0000450. Chiến lược thoát hiểm của chuột túi má (Gopher Strategy)

    ID: 3575 Loại: Thông thường 2000ms 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

Chiến lược thoát hiểm của chuột túi má (Gopher Strategy)

Gopher Strategy

Source: UVa

Version: Phuoc Hung OJ Extended

Problem Statement

There are mm gophers and nn shelters in a field. When a predator approaches, each gopher can run directly to a shelter at speed one distance unit per second. Each shelter can hold at most one gopher. At most kk gophers may be lost. Find the least time in which at least m−km-k gophers can occupy different shelters, or report that this is impossible.

Input

The first line contains integers m,n,km,n,k. The next mm lines give the real coordinates x,yx,y of the gophers, followed by nn lines giving the shelter coordinates.

Output

Print Case #1: on the first line. On the next line print the minimum time rounded to exactly three decimal places, or Too bad. if impossible. Follow with an empty line.

Subtasks

  • Subtask 1 (20 points): 0≤m,n≤500\le m,n\le50, 0≤k≤m0\le k\le m, m−k≤1m-k\le1; coordinates are real numbers (no explicit coordinate bound in the original); points may coincide. For a finite answer tt, ∣1000t−⌊1000t⌋−0.5∣>10−2|1000t-\lfloor1000t\rfloor-0.5|>10^{-2}.
  • Subtask 2 (30 points): 0≤m,n≤120\le m,n\le12, 0≤k≤m0\le k\le m; coordinates are real numbers (no explicit coordinate bound in the original); points may coincide. For a finite answer tt, ∣1000t−⌊1000t⌋−0.5∣>10−2|1000t-\lfloor1000t\rfloor-0.5|>10^{-2}.
  • Subtask 3 (50 points): 0≤m,n≤500\le m,n\le50, 0≤k≤m0\le k\le m; coordinates are real numbers (no explicit coordinate bound in the original); points may coincide. For a finite answer tt, ∣1000t−⌊1000t⌋−0.5∣>10−2|1000t-\lfloor1000t\rfloor-0.5|>10^{-2}.

Examples

Input 1

3 3 1
0 0
1 0
2 0
0 1
1 1
2 1.5

Output 1

Case #1:
1.000

Explanation 1

The first two gophers can use the shelters directly above them in one second. Every distance is at least 1.

Input 2

3 3 1
0 1
1 2
2 1
1 0
1 1
2 0

Output 2

Case #1:
1.000

Explanation 2

Send (0,1)(0,1) to (1,1)(1,1) and (2,1)(2,1) to (2,0)(2,0). No pair has distance below 1.

Input 3

3 3 0
0 1
1 2
2 1
1 0
1 1
2 0

Output 3

Case #1:
1.414

Explanation 3

Assign the three gophers to (1,0),(1,1),(2,0)(1,0),(1,1),(2,0) respectively. Below 2\sqrt2 the first two share their only accessible shelter, so all three cannot escape.

Input 4

1 0 0
100.0 200.5

Output 4

Case #1:
Too bad.

Explanation 4

One gopher must escape but no shelter exists.