#abc338e. E - Chords
E - Chords
Score: points
问题描述
在圆上等间距地放置了 个点,从某个特定点开始按顺时针方向编号为 到 。
圆上还有 条弦,其中第 条弦连接着点 和 。保证所有值 都互不相同。
判断这些弦之间是否存在相交的情况。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There are points placed at equal intervals on a circle, numbered to in a clockwise direction starting from a certain point.
There are also chords on the circle, with the -th chord connecting points and . It is guaranteed that all the values are distinct.
Determine whether there is an intersection between the chords.
Constraints
- are all distinct
- All input values are integers
Input
The input is given from Standard Input in the following format:
Output
If there is an intersection between the chords, print Yes
; otherwise, print No
.
Sample Input 1
3
1 3
4 2
5 6
Sample Output 1
Yes
As shown in the figure, chord (the line segment connecting points and ) and chord (the line segment connecting points and ) intersect, so print Yes
.
Sample Input 2
3
6 1
4 3
2 5
Sample Output 2
No
As shown in the figure, there is no intersection between the chords, so print No
.
Sample Input 3
4
2 4
3 7
8 6
5 1
Sample Output 3
Yes
update @ 2024/3/10 01:29:45