codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

849A.md (1833B)


      1 Source: https://codeforces.com/problemset/problem/849/A
      2 
      3 A. Odds and Ends
      4 
      5 time limit per test
      6 
      7 1 second
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 standard input
     16 
     17 output
     18 
     19 standard output
     20 
     21 Where do odds begin, and where do they end? Where does hope emerge, and will they ever break?
     22 
     23 Given an integer sequence *a*1, *a*2, ..., *a**n* of length *n*. 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.
     24 
     25 A subsegment is a contiguous slice of the whole sequence. For example, {3, 4, 5} and {1} are subsegments of sequence {1, 2, 3, 4, 5, 6}, while {1, 2, 4} and {7} are not.
     26 
     27 Input
     28 
     29 The first line of input contains a non-negative integer *n* (1 ≤ *n* ≤ 100) — the length of the sequence.
     30 
     31 The second line contains *n* space-separated non-negative integers *a*1, *a*2, ..., *a**n* (0 ≤ *a**i* ≤ 100) — the elements of the sequence.
     32 
     33 Output
     34 
     35 Output "Yes" if it's possible to fulfill the requirements, and "No" otherwise.
     36 
     37 You can output each letter in any case (upper or lower).
     38 
     39 Examples
     40 
     41 Input
     42 
     43 ```
     44 3  
     45 1 3 5
     46 ```
     47 
     48 Output
     49 
     50 ```
     51 Yes
     52 ```
     53 
     54 Input
     55 
     56 ```
     57 5  
     58 1 0 1 5 1
     59 ```
     60 
     61 Output
     62 
     63 ```
     64 Yes
     65 ```
     66 
     67 Input
     68 
     69 ```
     70 3  
     71 4 3 1
     72 ```
     73 
     74 Output
     75 
     76 ```
     77 No
     78 ```
     79 
     80 Input
     81 
     82 ```
     83 4  
     84 3 9 9 3
     85 ```
     86 
     87 Output
     88 
     89 ```
     90 No
     91 ```
     92 
     93 Note
     94 
     95 In the first example, divide the sequence into 1 subsegment: {1, 3, 5} and the requirements will be met.
     96 
     97 In the second example, divide the sequence into 3 subsegments: {1, 0, 1}, {5}, {1}.
     98 
     99 In the third example, one of the subsegments must start with 4 which is an even number, thus the requirements cannot be met.
    100 
    101 In the fourth example, the sequence can be divided into 2 subsegments: {3, 9, 9}, {3}, but this is not a valid solution because 2 is an even number.