SMPSEQ7 - Fun with Sequences (Act 5)
You are given S - a sequence of n integers S = s1, s2 ... sn. Please, compute if it is possible to split S into two parts: s1, s2 ... si and si+1, si+2 ... sn (1 <= i < n) in such a way that the first part is strictly decreasing while the second is strictly increasing one.
Input data specification
In the first line you are given an integer 2 <= n <= 100
and in the following line n integers
-100 <= si <= 100.
Output data specification
One word Yes or No.
Example 1
Input: 5 -1 2 -1 1 -1 Output: No
Example 2
Input: 6 3 1 -2 -2 -1 3 Output: Yes
Example 3
Input: 6 2 2 1 0 1 2 Output: No
hide comments
tty5hy:
2016-01-13 19:46:57
If no,There should be more than 2 same number? |
|
Nallagatla Manikanta:
2015-10-26 05:24:32
@raghavdua yes it is correct to split in that way. |
|
raghavdua:
2015-10-05 17:58:20
If I have a Case like:
|
Added by: | kuszi |
Date: | 2013-12-12 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |