Figures
InterviewTime limit1sMemory limit128 MB
Check whether any three consecutive figures contain one circle, one square, and one triangle.
- Level
Easy1 of 10
- Topics
- Sliding window, Array
- Solved
- No attempts yet
Problem
Jaś drew some figures in his notebook: circles, squares, and triangles, all in a single straight row. After finishing, he lent the notebook to Małgosia, who sits next to him.
Małgosia wants to find three different figures (a circle, a square, and a triangle), in any order, sitting right next to each other. Determine whether she can find such three different figures placed side by side.
Input
The first line contains a single integer (), the number of figures Jaś drew.
The second line contains integers () describing the figures in order. denotes the -th figure: 0 is a circle, 1 is a square, and 2 is a triangle.
Output
Print a single word TAK if Małgosia can find three different figures next to each other, or NIE otherwise.