A pair of neighboring elements with the same signs
Problem
You are given an array of integers. Write a program that determines if an array has a pair of adjacent elements with the same signs.
Input
First given number N
— the number of elements in the array (1<=N<=10000
). The N
numbers — array elements. The array consists of integers, each modulo no more than 100.
Imprint
Output the word
YES
if there is a pair of adjacent elements with the same signs. Otherwise, output the word
NO
.
Examples
# |
Input |
Output |
1 |
5
1 -3 4 -2 1
| NO |
Запрещенные операторы: sort
; min
; max
; reverse
; count
; sum
; index