{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":" National Association of Tennis is planning to hold a tennis competition among professional players. The competition is going to be a knockout tournament, and you are assigned the task to make the arrangement of players in the tournament. You are given the detailed report about all participants of the competition. The report contains the results of recent matches between all pairs of the participants. Examining the data, you\u0027ve noticed that it is only up to the opponent whether one player wins or not. Since one of your special friends are attending the competition, you want him to get the best prize. So you want to know the possibility where he wins the gold medal. However it is not so easy to figure out because there are many participants. You have decided to write a program which calculates the number of possible arrangements of tournament in which your friend wins the gold medal. In order to make your trick hidden from everyone, you need to avoid making a factitive tournament tree. So you have to consider only such tournaments that the height of your tournament tree is minimal possible. \u003cbr\u003e\u003cdiv align\u003d\"left\" style\u003d\"margin-top: 1.0em;\"\u003e\u003cb\u003eInput\u003c/b\u003e\u003c/div\u003eThe input has the format as described below. \u003cpre\u003e\u003ci\u003eN\u003c/i\u003e \u003ci\u003eM\u003c/i\u003e\n\u003ci\u003eR\u003c/i\u003e\u003csub\u003e11\u003c/sub\u003e \u003ci\u003eR\u003c/i\u003e\u003csub\u003e12\u003c/sub\u003e... \u003ci\u003eR\u003c/i\u003e\u003csub\u003e1N\u003c/sub\u003e\n\u003ci\u003eR\u003c/i\u003e\u003csub\u003e21\u003c/sub\u003e \u003ci\u003eR\u003c/i\u003e\u003csub\u003e22\u003c/sub\u003e... \u003ci\u003eR\u003c/i\u003e\u003csub\u003e2N\u003c/sub\u003e\n...\n\u003ci\u003eR\u003c/i\u003e\u003csub\u003e\u003ci\u003eN\u003c/i\u003e1\u003c/sub\u003e \u003ci\u003eR\u003c/i\u003e\u003csub\u003e\u003ci\u003eN\u003c/i\u003e2\u003c/sub\u003e... \u003ci\u003eR\u003c/i\u003e\u003csub\u003e\u003ci\u003eNN\u003c/i\u003e\u003c/sub\u003e\n\u003c/pre\u003e \u003ci\u003eN\u003c/i\u003e is the number of players (1 ≤ \u003ci\u003eN\u003c/i\u003e ≤ 16), and \u003ci\u003eM\u003c/i\u003e is your friend\u0027s ID (numbered from 1). \u003ci\u003eR\u003c/i\u003e\u003csub\u003e\u003ci\u003eij\u003c/i\u003e\u003c/sub\u003e is the result of a match between the \u003ci\u003ei\u003c/i\u003e-th player and the \u003ci\u003ej\u003c/i\u003e-th player. When \u003ci\u003ei\u003c/i\u003e-th player always wins, \u003ci\u003eR\u003c/i\u003e\u003csub\u003e\u003ci\u003eij\u003c/i\u003e\u003c/sub\u003e \u003d 1. Otherwise, \u003ci\u003eR\u003c/i\u003e\u003csub\u003e\u003ci\u003eij\u003c/i\u003e\u003c/sub\u003e \u003d 0. It is guaranteed that the matrix is consistent: for all \u003ci\u003ei\u003c/i\u003e !\u003d \u003ci\u003ej\u003c/i\u003e, \u003ci\u003eR\u003c/i\u003e\u003csub\u003e\u003ci\u003eij\u003c/i\u003e\u003c/sub\u003e \u003d 0 if and only if \u003ci\u003eR\u003c/i\u003e\u003csub\u003e\u003ci\u003eji\u003c/i\u003e\u003c/sub\u003e \u003d 1. The diagonal elements \u003ci\u003eR\u003c/i\u003e\u003csub\u003e\u003ci\u003eii\u003c/i\u003e\u003c/sub\u003e are just given for convenience and are always 0. \u003cbr\u003e\u003cdiv align\u003d\"left\" style\u003d\"margin-top: 1.0em;\"\u003e\u003cb\u003eOutput\u003c/b\u003e\u003c/div\u003eYour program should output in a line the number of possible tournaments in which your friend wins the first prize. \u003cbr\u003e"}},{"title":"Sample 1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2 1\n0 1\n0 0\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 2","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2 1\n0 0\n1 0\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 3","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3 3\n0 1 1\n0 0 1\n0 0 0\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 4","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3 3\n0 1 0\n0 0 0\n1 1 0\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e3\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 5","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3 1\n0 1 0\n0 0 0\n1 1 0\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 6","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3 3\n0 1 0\n0 0 1\n1 0 0\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 7","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4 1\n0 0 0 1\n1 0 0 1\n1 1 0 0\n0 0 1 0\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 8","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e6 4\n0 0 0 0 0 1\n1 0 1 0 1 0\n1 0 0 1 1 0\n1 1 0 0 1 0\n1 0 0 0 0 0\n0 1 1 1 1 0\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e11\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 9","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e7 2\n0 1 0 0 0 1 0\n0 0 1 0 1 1 1\n1 0 0 1 1 0 0\n1 1 0 0 0 1 0\n1 0 0 1 0 0 1\n0 0 1 0 1 0 0\n1 0 1 1 0 1 0\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e139\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Sample 10","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e8 6\n0 0 0 0 1 0 0 0\n1 0 1 1 0 0 0 0\n1 0 0 0 1 0 0 0\n1 0 1 0 0 1 0 1\n0 1 0 1 0 0 1 0\n1 1 1 0 1 0 0 1\n1 1 1 1 0 1 0 0\n1 1 1 0 1 0 1 0\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e78\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}