Public submissions
Source code of every submission to this problem in this contest will be visible for everyone since 2013-12-13 17:19:31.

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

Added by:kuszi
Date:2013-12-12
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Public source code since: 2013-12-13 17:19:31

hide comments
2014-07-09 07:45:00 himanshu joshi
I am getting correct output when i m doing doing it on my system but after submission it is showing wrong answer.I am unable to find the bug please help me code id::11914800
2014-03-20 15:58:57 kuszi
@pooja biswas: "strictly" added to avoid confusion

Last edit: 2014-03-20 15:59:15
2014-03-19 08:03:27 anuraag
why example 3 is wrong ? is there shold be only a single way to split ?
2014-03-16 22:16:51 kuszi
@Antek Given
1
2 1 1
as input your program 11244379 outputs Yes
this is correct. Seems ok.
2014-03-14 00:42:09 Antek
I got AC even if my solution doesn't handle input like 2 1 1...
2014-01-19 09:27:22 Kaustubh Mallik
what about descending behavior if two numbers are same and then ascending behavior starts. Is it accepted?
2014-01-15 13:24:04 kuszi
@Snehasish Karmakar: Yes
2014-01-14 14:12:05 Snehasish Karmakar
@Łukasz Kuszner : So, outputs for the sequences "2 1" and "1 2" would be "Yes" and "Yes"?
2014-01-14 11:07:32 kuszi
@Snehasish Karmakar: Yes
2014-01-14 08:00:54 Snehasish Karmakar
@Łukasz Kuszner : Is it ok if any of or both the parts contain only one integer?
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.