Input: Y Is Not Reachable From The Start Node Then Node Y Does Not
Input: Y Is Not Reachable From The Start Node Then Node Y Does Not
Input
The first line of input will contain T (≤ 100) denoting the
number of cases.
Each case starts with an integer N (0 < N < 100) that
represents the number of nodes in the graph. The next N lines contain N integers each. If the j-th (0
based) integer of i-th (0 based) line is ‘1’, it means that there is an edge from node i to node j and
similarly a ‘0’ means there is no edge.
Output
For each case, output the case number first. Then output 2N + 1 lines that summarizes the dominator
relationship between every pair of nodes. If node A dominates node B, output ‘Y’ in cell (A, B),
otherwise output ‘N’. Cell (A, B) means cell at A-th row and B-th column. Surround the output with
‘|’, ‘+’ and ‘-’ to make it more legible. Look at the samples for exact format.
Sample Input
2
5
0 1 1 0 0
0 0 0 1 0
0 0 0 1 0
0 0 0 0 1
0 0 0 0 0
1
1
Sample Output
Case 1:
+---------+
|Y|Y|Y|Y|Y|
+---------+
|N|Y|N|N|N|
+---------+
|N|N|Y|N|N|
+---------+
|N|N|N|Y|Y|
+---------+
|N|N|N|N|Y|
+---------+
Case 2:
+-+
|Y|
+-+