Editorial for DMOPC '15 Contest 3 P3 - Dimethylbenzene


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: Xyene

Knowledge required: DFS or for loops

This problem involves a graph of a molecule — however, this does not mean it requires any knowledge of graph theory to solve! Since the bounds are small (up to 20 atoms and bonds), one does not have to implement a functional graph traversal: seven nested for loops work.

Remember that a bond between u and v implies a bond between v and u.

Time Complexity: \mathcal{O}(N^7)


Comments


  • 15
    pro  commented on Nov. 23, 2017, 2:58 p.m.

    DOES TIME COMPLEXITY NOT EXIST IN THIS PROBLEM?!!!O(N^7)???!!!!!