Blueberry garden

An alien botanist is trying to grow blueberries. He has some blueberry seeds from Earth, but they got mixed with local sunshroom and fernivore seeds. He decides to plant them anyway because he really wants to know what blueberries taste like.
His garden has 10 slots for planting, all next to each other. He plants seeds in all of those 10 slots and waits for them to grow.
Image created with DALL-E 2
Image created with DALL-E 2
However, he needs to be careful, because fernivores are harmful to blueberries and will contaminate blueberry plants directly next to them. Sunshrooms are harmless and they also neutralize a fernivore plant when it grows directly next to it.
You are given 10 integers as input, each one representing one slot, and your task is to determine if there is a contamination in the garden.
  • Blueberries are represented by even numbers that are not divisible by 6.
  • Sunshrooms are represented by odd numbers.
  • Fernivores are represented by multiples of 6.
If there is contamination, print Activate emergency protocol!, otherwise print Check complete, blueberries are growing!.
Input
Output
4 8 3 6 2 7 14 16 2 13
Check complete, blueberries are growing!
2 3 7 2 8 12 4 8 9 10
Activate emergency protocol!
9 3 1 2 4 3 3 7 6 6
Check complete, blueberries are growing!
9 8 5 6 12 4 13 2 3 7
Activate emergency protocol!
  1. In the first example, there is one fernivore at slot #4, represented by 6. However, it is neutralized by the sunshroom at slot #3, which is represented by 3, so we print Check complete, blueberries are growing!.
  1. In the second example, there is a fernivore at slot #6 surrounded by blueberries that has contaminated the garden, therefore we print Activate emergency protocol!.
  1. In the third example, there are two fernivores at slots #9 and #10, but they are not next to any blueberries, so there will be no contamination, therefore we print Check complete, blueberries are growing!.
  1. In the last example, there are two fernivores at slots #4 and #5. The fernivore at slot #5 will contaminate the blueberry at slot #6. Notice that there is a sunshroom at slot #3, but it will only neutralize the fernivore at slot #4, so the fernivore at slot #5 will contaminate the garden!
Tip
Try to solve this challenge using for … else and break!

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue