PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GD0000082. Tưới cỏ (Watering Grass)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Tưới cỏ (Watering Grass)
Watering Grass
Source: Kattis
Version: Phuoc Hung OJ Extended
Problem Statement
A rectangular lawn has length and width . There are sprinklers on its longitudinal centerline; sprinkler is at horizontal coordinate and covers a circle of radius . Find the minimum number of sprinklers whose combined coverage includes the entire rectangle, or -1 if impossible.
Input
The first line contains integers . Each of the next lines contains integers in meters.
Output
Print the minimum number of sprinklers, or -1 if full coverage is impossible.
Subtasks
- Subtask 1 (20 points): ; ; ; .
- Subtask 2 (30 points): ; ; ; .
- Subtask 3 (50 points): ; ; ; .
Examples
Input
3 10 2
3 5
9 3
6 1
Output
2
Explanation
The sprinkler at covers the full strip horizontally from about to ; the one at covers from about to . Their union covers , while neither sprinkler does so by itself. Two are necessary.