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
2015-08-08 09:16:12 kuszi
for a test

2
1 2

output is "Yes" (i=1)
2015-08-07 11:10:54
what will be output for this?
2
1 2
2015-05-07 18:51:39 kuszi
@lopiavodsky In both cases the answer is "Yes". For example you can split "9 8 7" | "6" and "6" | "7 8 9".
2015-05-07 18:47:16 kuszi
@prodigy_coder If you are asking for the submissions of other users then: "all submissions" (from the top menu) and clicking the particular submission ID gives the code.
2015-05-07 07:21:45 prodigy_coder
Is there a way to see the codes of other submissions? How do u do it?
2015-01-28 08:13:12 lopiavodsky
what about 9 8 7 6 or 6 7 8 9( all are ascending order or discending order?) Are they true?
2014-11-06 09:08:35 astrolion
WA test4... @Ɓukasz Kuszner

Last edit: 2014-11-06 09:21:25
2014-10-07 21:40:02 kuszi
@Yugratna Srivastava "strictly decreasing" means that the element is less than the previous one.

Given 8 5 4 4 4 2 3 1 the anwser is "No".



Last edit: 2014-10-07 21:40:55
2014-10-07 14:08:20 Yugratna Srivastava
In example 3, 2 2 1 0 1 2 : the first part must be descending, so can it not be with single element which is repeated?
taking 2 2 1 as descending and 0 1 2 as ascending? My code executes on my system, but here it does not.
And what output should 8 5 4 4 4 2 3 1 give?
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.