{"trustable":true,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n #problem-body \u003e pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv id\u003d\"problem-body\"\u003e\n\t\u003ch3\u003eProblem\u003c/h3\u003e\r\n\u003cp align\u003d\"justify\"\u003e\r\nYour task will be to calculate number of different assignments of n different topics to n students such that everybody gets exactly one topic he likes.\r\n\u003c/p\u003e\r\n\u003ch3\u003eInput\u003c/h3\u003e\r\n\u003cp align\u003d\"justify\"\u003e\r\nFirst line of input contains number of test cases c (1\u0026lt;\u003dc\u0026lt;\u003d80). Each test case begins with number of students n (1\u0026lt;\u003dn\u0026lt;\u003d20). Each of the next n lines contains n integers describing preferences of one student. 1 at the ith position means that this student likes ith topic, 0 means that he definitely doesn\u0027t want to take it.\r\n\u003c/p\u003e\r\n\u003ch3\u003eOutput\u003c/h3\u003e\r\n\u003cp align\u003d\"justify\"\u003e\r\nFor each test case output number of different assignments (it will fit in a signed 64-bit integer).\r\n\u003c/p\u003e\r\n\u003ch3\u003eExample\u003c/h3\u003e\r\n\u003cpre\u003e\r\nInput:\r\n3\r\n3\r\n1 1 1\r\n1 1 1\r\n1 1 1\r\n11\r\n1 0 0 1 0 0 0 0 0 1 1 \r\n1 1 1 1 1 0 1 0 1 0 0 \r\n1 0 0 1 0 0 1 1 0 1 0 \r\n1 0 1 1 1 0 1 1 0 1 1 \r\n0 1 1 1 0 1 0 0 1 1 1 \r\n1 1 1 0 0 1 0 0 0 0 0 \r\n0 0 0 0 1 0 1 0 0 0 1 \r\n1 0 1 1 0 0 0 0 0 0 1 \r\n0 0 1 0 1 1 0 0 0 1 1 \r\n1 1 1 0 0 0 1 0 1 0 1 \r\n1 0 0 0 1 1 1 1 0 0 0 \r\n11\r\n0 1 1 1 0 1 0 0 0 1 0 \r\n0 0 1 1 1 1 1 1 1 1 1 \r\n1 1 0 1 0 0 0 0 0 1 0 \r\n0 1 0 1 0 1 0 1 0 1 1 \r\n1 0 0 1 0 0 0 0 1 0 1 \r\n0 0 1 0 1 1 0 0 0 0 1 \r\n1 0 1 0 1 1 1 0 1 1 0 \r\n1 0 1 1 0 1 1 0 0 1 0 \r\n0 0 1 1 0 1 1 1 1 1 1 \r\n0 1 0 0 0 0 0 0 0 1 1 \r\n0 1 1 0 0 0 0 0 1 0 1 \r\n\r\nOutput:\r\n6\r\n7588\r\n7426\r\n\r\n\u003c/pre\u003e\r\n\n\u003c/div\u003e"}}]}