Problem Statement | |||||||||||||
A graph is called split if the vertices can be partioned into two non-empty sets A and B such that no two distinct vertices in A are adjacent, and all pairs of distinct vertices in B are adjacent. Considering all possible ways of removing 0 or more nodes from the given graph, return how many of the resulting subgraphs are split. Two subgraphs are considered distinct if the sets of removed nodes are distinct. Character i in element j of graph is '1' if nodes i and j are adjacent, and '0' if not. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | graph will contain between 1 and 20 elements, inclusive. | ||||||||||||
- | Each character in graph will be '0' or '1'. | ||||||||||||
- | Each element of graph will contain exactly N characters, where N is the number of elements in graph. | ||||||||||||
- | Character i of element i of graph will always be '0'. | ||||||||||||
- | Character i of element j of graph will equal character j of element i. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
|