#P15504. [ICPC 2025 APC] Can You Reach There?
[ICPC 2025 APC] Can You Reach There?
Description
You are given distinct marked points on a 2D plane, numbered from to . Marked point has coordinates . In this problem, you are given scenarios, numbered from to . In each scenario , four integers , , , and are given, indicating that you initially stand at and aim to reach by repeating the steps described below any number of times.
In a single step, you choose two marked points and , which may be identical. Let denote the point where you are currently standing, and define a point by
In other words, is chosen so that the vector from to has the same direction and length as the vector from to . You may then move to any point on the segment , including the point itself, and you will stand at that new point.
For each scenario, determine whether the objective can be achieved using the described steps. Note that all scenarios are independent of each other.
Input Format
The first line of input contains two integers and (, ). The -th of the next lines contains two integers and (). The input guarantees that no two marked points have the same coordinates.
The next lines represent the scenarios. The -th of these lines contains four integers , , , and (; ).
Output Format
Output lines. The -th line should contain yes if the objective of scenario is achievable, or no otherwise.
2 4
10 0
0 10
3 4 6 5
4 0 7 0
4 0 16 0
123 456 789 0
yes
yes
yes
no
Hint
Explanation for the sample input/output #1
There are two marked points and . In scenario 1, starting from the point , the objective is achieved as follows:
- In the first step, choose as and as . A point is determined with coordinates . Move to a point , which lies on the segment . (Figure M.1 (a))
- In the next step, choose as both and . A point is determined with coordinates . From there, you can reach the point . (Figure M.1 (b))
In scenario 2, you start from . Choose as both and . A point is determined with coordinates . The point is on the segment , allowing you to reach there in a single step. (Figure M.1 (c))
In scenario 3, the objective is similarly achievable.
In scenario 4, it can be shown that reaching the point from is impossible.
:::align{center}

Figure M.1: Illustrations of the scenarios in Sample Input #1. :::
京公网安备 11011102002149号