Problem Statement | |||||||||||||
In a chess tournament, each pair of distinct players played a single match against each other. Each match resulted in one of three outcomes: the first player won, the second player won, or there was a draw. The ambiguity number of the tournament is defined as the number of distinct triples of players (a, b, c) such that player a defeated b, player b defeated player c, and player c defeated player a. You are given the results of all the matches as a String[] table. The j-th character of the i-th element of table is '1' (one) if player i defeated player j, '0' (zero) if player j defeated player i, or '-' if the match between players i and j resulted in a draw. Return the ambiguity number of the given tournament. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | table will contain between 1 and 50 elements, inclusive. | ||||||||||||
- | Each element of table will contain exactly n characters, where n is the number of elements in table. | ||||||||||||
- | Each character in each element of table will be '1' (one), '0' (zero), or '-'. | ||||||||||||
- | The i-th character of the j-th element of table will be '1' if and only if the j-th character of the i-th element of table is '0'. | ||||||||||||
- | The i-th character of the j-th element of table will be '-' if and only if the j-th character of the i-th element of table is '-'. | ||||||||||||
- | The i-th character of the i-th element of table will be '-'. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
|