CF849A.Odds and Ends

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Where do odds begin, and where do they end? Where does hope emerge, and will they ever break?

Given an integer sequence a1,a2,...,ana_{1},a_{2},...,a_{n} of length nn . Decide whether it is possible to divide it into an odd number of non-empty subsegments, the each of which has an odd length and begins and ends with odd numbers.

A subsegment is a contiguous slice of the whole sequence. For example, 3,4,5{3,4,5} and 1{1} are subsegments of sequence 1,2,3,4,5,6{1,2,3,4,5,6} , while 1,2,4{1,2,4} and 7{7} are not.

输入格式

The first line of input contains a non-negative integer nn ( 1<=n<=1001<=n<=100 ) — the length of the sequence.

The second line contains nn space-separated non-negative integers a1,a2,...,ana_{1},a_{2},...,a_{n} ( 0<=ai<=1000<=a_{i}<=100 ) — the elements of the sequence.

输出格式

Output "Yes" if it's possible to fulfill the requirements, and "No" otherwise.

You can output each letter in any case (upper or lower).

输入输出样例

  • 输入#1

    3
    1 3 5
    

    输出#1

    Yes
    
  • 输入#2

    5
    1 0 1 5 1
    

    输出#2

    Yes
    
  • 输入#3

    3
    4 3 1
    

    输出#3

    No
    
  • 输入#4

    4
    3 9 9 3
    

    输出#4

    No
    

说明/提示

In the first example, divide the sequence into 11 subsegment: 1,3,5{1,3,5} and the requirements will be met.

In the second example, divide the sequence into 33 subsegments: 1,0,1{1,0,1} , 5{5} , 1{1} .

In the third example, one of the subsegments must start with 44 which is an even number, thus the requirements cannot be met.

In the fourth example, the sequence can be divided into 22 subsegments: 3,9,9{3,9,9} , 3{3} , but this is not a valid solution because 22 is an even number.

首页