LCC '21 Contest 4 J1 - Colourful Buttons

View as PDF

Submit solution

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

As a gift, you received a row of N buttons! These buttons are special, and each time you press one, they will turn into a different colour (there are no duplicate colours). All the buttons are programmed to follow the same sequence of colour changes as they are pressed. For example, if a sequence of colours is red green blue, any button that is pressed twice will be green.

All buttons start as the same colour when they have not been pressed yet. Given the number of times each button was pressed, determine whether each button has a different colour from the button directly to its left, except for the first/leftmost button.

Input Specification

The first line will contain an integer N, the number of buttons in the row.

The next line will contain N integers, each one representing the number of times the specific button has been pressed.

Output Specification

Output colourful! if each button is a different colour from the button directly to its left (ignoring the leftmost one), or not colourful if it is not.

Sample Input 1

5
1 2 3 2 5

Sample Output 1

colourful!

Sample Explanation

Each button has been pressed a different number of times compared to the button to its left, so they are different colours, thus being colourful.

Sample Input 2

6
1 2 1 2 2 1

Sample Output 2

not colourful

Comments

There are no comments at the moment.