PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GD0000055. Chốt vuông và lỗ tròn (Square Pegs)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Chốt vuông và lỗ tròn (Square Pegs)
Square Pegs
Source: Kattis
Version: Phuoc Hung OJ Extended
Problem Statement
There are round holes of radii , round pegs of radii , and square pegs of side lengths . A hole holds at most one peg. A round peg fits if its radius is no larger than the hole radius; a square fits if its diagonal is no larger than the hole diameter. Maximize installed pegs.
Input
Line 1: counts of round holes, round pegs, square pegs. Line 2: hole radii . Line 3: round-peg radii . Line 4: square-peg side lengths .
Output
Print the maximum number of pegs that fit.
Subtasks
- Subtask 1 (20 points): ; ; for all valid indices.
- Subtask 2 (30 points): ; ; for all valid indices.
- Subtask 3 (50 points): ; ; for all valid indices.
Examples
Input
3 1 2
2 3 4
2
4 5
Output
3
Explanation
The radius-2 hole holds the round peg of radius 2. Square side 4 needs radius , fitting radius 3; square side 5 needs about 3.536, fitting radius 4. All three fit.