acmsguru |
---|
Finished |
N M R11 R12... R1N R21 R22... R2N ... RN1 RN2... RNNN is the number of players (1 ≤ N ≤ 16), and M is your friend's ID (numbered from 1). Rij is the result of a match between the i-th player and the j-th player. When i-th player always wins, Rij = 1. Otherwise, Rij = 0. It is guaranteed that the matrix is consistent: for all i != j, Rij = 0 if and only if Rji = 1. The diagonal elements Rii are just given for convenience and are always 0.
sample input | sample output |
2 1 0 1 0 0 | 1 |
sample input | sample output |
2 1 0 0 1 0 | 0 |
sample input | sample output |
3 3 0 1 1 0 0 1 0 0 0 | 0 |
sample input | sample output |
3 3 0 1 0 0 0 0 1 1 0 | 3 |
sample input | sample output |
3 1 0 1 0 0 0 0 1 1 0 | 0 |
sample input | sample output |
3 3 0 1 0 0 0 1 1 0 0 | 1 |
sample input | sample output |
4 1 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 0 | 0 |
sample input | sample output |
6 4 0 0 0 0 0 1 1 0 1 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 0 0 0 0 0 1 1 1 1 0 | 11 |
sample input | sample output |
7 2 0 1 0 0 0 1 0 0 0 1 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 0 1 0 1 0 0 1 0 0 1 0 0 1 0 1 0 0 1 0 1 1 0 1 0 | 139 |
sample input | sample output |
8 6 0 0 0 0 1 0 0 0 1 0 1 1 0 0 0 0 1 0 0 0 1 0 0 0 1 0 1 0 0 1 0 1 0 1 0 1 0 0 1 0 1 1 1 0 1 0 0 1 1 1 1 1 0 1 0 0 1 1 1 0 1 0 1 0 | 78 |
Name |
---|