301890: CF358A. Dima and Continuous Line

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Dima and Continuous Line

题意翻译

【问题描述】 在$x$轴上存在$n$个点$(x1,0),(x2,0),(x3,0)...(xn,0)$,以相邻两点$(xi,0)$与$(xi+1,0)$连线作为直径向上作半圆,问是否有除$x$轴上的交点。 【输入格式】 每组输入包含$n+1$行$:$ 第$1$行是整数$n$,表示序列长度。 第$2$~$n+1$行每行一个整数表示序列中各数。 【输出格式】 对于每组输入输出一行,若相交,输出$'yes'$,否则输出$'no'$。 【数据范围】 $100$%的数据满足:$1<=n<=10^3, - 10^6 ≤ xi ≤ 10^6$,最多五组数据

题目描述

Dima and Seryozha live in an ordinary dormitory room for two. One day Dima had a date with his girl and he asked Seryozha to leave the room. As a compensation, Seryozha made Dima do his homework. The teacher gave Seryozha the coordinates of $ n $ distinct points on the abscissa axis and asked to consecutively connect them by semi-circus in a certain order: first connect the first point with the second one, then connect the second point with the third one, then the third one with the fourth one and so on to the $ n $ -th point. Two points with coordinates $ (x_{1},0) $ and $ (x_{2},0) $ should be connected by a semi-circle that passes above the abscissa axis with the diameter that coincides with the segment between points. Seryozha needs to find out if the line on the picture intersects itself. For clarifications, see the picture Seryozha showed to Dima (the left picture has self-intersections, the right picture doesn't have any). ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF358A/055f7a9956e4776dad6e638193fc0fef424d2028.png)Seryozha is not a small boy, so the coordinates of the points can be rather large. Help Dima cope with the problem.

输入输出格式

输入格式


The first line contains a single integer $ n $ $ (1<=n<=10^{3}) $ . The second line contains $ n $ distinct integers $ x_{1},x_{2},...,x_{n} $ $ (-10^{6}<=x_{i}<=10^{6}) $ — the $ i $ -th point has coordinates $ (x_{i},0) $ . The points are not necessarily sorted by their $ x $ coordinate.

输出格式


In the single line print "yes" (without the quotes), if the line has self-intersections. Otherwise, print "no" (without the quotes).

输入输出样例

输入样例 #1

4
0 10 5 15

输出样例 #1

yes

输入样例 #2

4
0 15 5 10

输出样例 #2

no

说明

The first test from the statement is on the picture to the left, the second test is on the picture to the right.

Input

题意翻译

【问题描述】 在$x$轴上存在$n$个点$(x1,0),(x2,0),(x3,0)...(xn,0)$,以相邻两点$(xi,0)$与$(xi+1,0)$连线作为直径向上作半圆,问是否有除$x$轴上的交点。 【输入格式】 每组输入包含$n+1$行$:$ 第$1$行是整数$n$,表示序列长度。 第$2$~$n+1$行每行一个整数表示序列中各数。 【输出格式】 对于每组输入输出一行,若相交,输出$'yes'$,否则输出$'no'$。 【数据范围】 $100$%的数据满足:$1<=n<=10^3, - 10^6 ≤ xi ≤ 10^6$,最多五组数据

加入题单

上一题 下一题 算法标签: