Programming contests

DEIK Regionális Programozó Csapatverseny, középiskolai kategória, 2019. december 8.

December 8, 2019 10:15 AM – December 8, 2019 3:15 PM


The view of a big city is really impressive: a lot of skyscrapers, which can be seen well from a distance. Due to this, most big cities can easily be recognized from a photo, as their buildings are iconic.

Code City is rapidly developing as the capital of Code Country. The mayor of the city pays big attention to all construction works. His goal is to create the most beautiful city, so he announced a rigorous order: all buildings must be designed so that they produce a tiered view. This means that the height of each building must differ from the height of its two neighbors by exactly one story.

Input Specification

Each line of the input contains the height of the buildings of a street. The values follow each other in the order of the buildings, and all buildings are at least 1 story tall.

Output Specification

For each street, output one line containing the word “YES” or “NO” depending on whether the given street satisfies the regulation or not.

Sample Input

  1. 2 3 4 5 6 7 8 9
  2. 5 6 7 6 5
  3. 7 8 9 30 29 1
  4. 50 50 50
download as text file

Output for Sample Input

  1. YES
  2. YES
  3. NO
  4. NO
download as text file
University of Debrecen; Faculty of Informatics; v. 03/01/2019