#DSU0000058. Các đường tròn (Circumferences)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Các đường tròn (Circumferences)
Circumferences
Source: AtCoder
Version: Phuoc Hung OJ Extended
Problem Statement
There are circles in the plane. Circle has center and positive radius . Two points and are given; each is guaranteed to lie on the circumference of at least one circle.
You may travel only along circumferences: every point of your path must belong to the circumference of some given circle. You may move in either direction along a circle and switch between circles at a point that lies on both circumferences. Traveling through the interior of a disk is not allowed unless those points also lie on some circumference.
Determine whether a continuous journey from to satisfying these rules exists. Tangent circles also allow a transfer at their point of tangency.
Input
The first line is ; the second has ; the next lines give .
Output
Print Yes or No, case-sensitively.
Subtasks
- Subtask 1 (20 points): ; , ; both and lie on at least one circumference.
- Subtask 2 (30 points): ; , ; both and lie on at least one circumference.
- Subtask 3 (50 points): ; , ; both and lie on at least one circumference.
Examples
Input
3
0 1 0 3
0 0 1
0 0 2
0 0 3
Output
No
Explanation
Concentric circles with different radii do not intersect, so the endpoints are disconnected.