TSOC '15 Contest 1 #1 - Molecular or Non-Molecular?

View as PDF

Submit solution

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

Authors:
Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

BMP and MSA are on a mission to find the secret formula for one of the most delicious treats in the world. Cheesecake. In order to obtain this secret formula, BMP and MSA must first travel to France and meet with one of the world's most famous chefs, Jung Ho, and collect some essential information about cheesecake.

When they arrive in France, they realize that Jung Ho is not there. Thankfully, all of his famous recipes are nicely laid out on tables. BMP remembers that all the ingredients to the cheesecake recipe are molecular compounds, meaning they're only made of non-metals. BMP is presented with N compounds. For each compound, help BMP figure out whether it is a molecular compound or not. To make things easier, each element is separated with a space. You should assume that a compound is considered molecular if all of its component elements are non-metals.

BMP knows that the non-metal elements are Cl, Br, Xe, Kr, Si, As, Rn, Ne, He, H, C, N, O, F, P, S, and I.

Input Specification

The first line contains a single integer N (1 \le N \le 250).

The next N lines contain space separated elements — the formula that you will need to check. Each line of input contains under 100 space separated elements.

Output Specification

Identify whether the formula forms a molecular or non-molecular compound. If it forms a molecular compound, output Molecular!. If not, output Not molecular!. Use proper punctuation and capitalization or your solution will be rejected.

Sample Input

3
Na Cl
H H O
C H H H H H O O

Sample Output

Not molecular!
Molecular!
Molecular!

Comments


  • 3
    BMP  commented on Feb. 15, 2018, 9:22 p.m.

    .strip() is important