eolymp
bolt
Try our new interface for solving problems
Problems

Smooth contest

Smooth contest

Andrey doesn't like sharp drops, especially in contests. Two numbers $a$ and $b$ form a sharp drop if $|a-b| > 1$. The competition is considered smooth if no difficulties of two neighboring problems form a sharp drop. You are given $5$ numbers --- the complexity of the problems. Determine if these tasks form a smooth competition. \InputFile The first line contains five integers $a$, $b$, $c$, $d$, $e$ ($1 \le a, b, c, d, e \le 10^6$) --- problem complexity . \OutputFile Print <<\t{YES}>> if the numbers form a smooth competition, and <<\t{NO}>> otherwise. \Note Explanation for the first example: $|1-2| = 1$, $|2-2| = 0$, $|2-2| = 0$, $|2-1| = $1. None of these pairs form a sharp drop, so the numbers ${1,2,2,2,1}$ form a smooth contest. Explanation for the second example: $|1-2| = 1$, $|2-2| = 0$, $|2-1| = 1$, $|1-3| = $2. As you can see, the last two numbers form a sharp drop, so the numbers ${1,2,2,1,3}$ do not form a smooth contest.
Time limit 1 second
Memory limit 128 MiB
Input example #1
1 2 2 2 1
Output example #1
Yes
Input example #2
1 2 2 1 3
Output example #2
No
Author Andrii Stolitnii
Source ВЮДОІ 2023 stage I