#BS0000450. Chiến lược thoát hiểm của chuột túi má (Gopher Strategy)
Bài tập thuộc lộ trình
Mục lục đề ⌄
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 gophers and 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 gophers may be lost. Find the least time in which at least gophers can occupy different shelters, or report that this is impossible.
Input
The first line contains integers . The next lines give the real coordinates of the gophers, followed by 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): , , ; coordinates are real numbers (no explicit coordinate bound in the original); points may coincide. For a finite answer , .
- Subtask 2 (30 points): , ; coordinates are real numbers (no explicit coordinate bound in the original); points may coincide. For a finite answer , .
- Subtask 3 (50 points): , ; coordinates are real numbers (no explicit coordinate bound in the original); points may coincide. For a finite answer , .
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 to and to . 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 respectively. Below 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.