#K80837. Chess Tournament Analysis
Chess Tournament Analysis
Chess Tournament Analysis
In a round-robin chess tournament, n players each play against every other player exactly once. The outcome of each game is recorded in an n x n matrix \(M\), where:
- \(M[i][j] = 1\) if player \(i\) wins against player \(j\),
- \(M[i][j] = -1\) if player \(i\) loses to player \(j\), and
- \(M[i][j] = 0\) if the game ends in a draw or if \(i = j\).
Alice is the first player (index 0) and her performance is of special interest. Your task is to calculate and print the following statistics:
- The total number of games played in the tournament, which is \(\frac{n \times (n-1)}{2}\).
- The number of wins for Alice.
- The number of losses for Alice.
- The number of draws for Alice (games that ended in a draw, excluding the self-match).
Print these four numbers in a single line separated by spaces.
inputFormat
The first line contains an integer \(n\) representing the number of players.
The next \(n\) lines each contain \(n\) space-separated integers representing the matrix \(M\). The \(j\)-th number in the \(i\)-th line denotes the result of the game between players \(i\) and \(j\).
outputFormat
Output a single line containing four space-separated integers: the total number of games in the tournament, the number of wins for Alice, the number of losses for Alice, and the number of draws for Alice.
## sample3
0 1 -1
-1 0 1
1 -1 0
3 1 1 0
</p>