{"trustable":false,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n section 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\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"Problem Statement","value":{"format":"MD","content":"## 题目描述\n\n有 $N$ 个盒子。盒子 $i$ 里有 $L_i$ 个球。盒子 $i$ 里的第 $j$($1 \\le j \\le L_i$)个球上写有一个数字 $a_{i, j}$。我们会从每个盒子中各挑选一个球。请问有多少种选取方法使得球上的数字的乘积为 $X$?所有球均视作为是不同,即便有些球上的数字是相同的。\n\n## 数据范围\n\n* $N \\ge 2$\n* $L_i \\ge 2$\n* 每个盒子中球的数量的乘积至多为 $10^5$:$\\prod \\limits_{i \u003d 1}^N L_i \\le 10^5$。\n* $1 \\le a_{i, j} \\le 10^9$\n* $1 \\le X \\le 10^{18}$\n* 所有输入均为整数。\n\n## 输入格式\n\n输入按照以下格式给出:\n\n$N \\ X \\\\\\\\ L_1 \\ a_{1, 1} \\ a_{1, 2} \\dots a_{1, L_1} \\\\\\\\ L_2 \\ a_{2, 1} \\ a_{2, 2} \\dots a_{2, L_2} \\\\\\\\ \\vdots \\\\\\\\ L_N \\ a_{N, 1} \\ a_{N, 2} \\dots a_{N, L_N}$\n\n## 输出格式\n\n输出答案。\n\n\u003csection\u003e\n \u003cp\u003eWe have \u003cvar\u003e\\(N\\)\u003c/var\u003e bags.\u003cbr\u003e\n Bag \u003cvar\u003e\\(i\\)\u003c/var\u003e contains \u003cvar\u003e\\(L_i\\)\u003c/var\u003e balls. The \u003cvar\u003e\\(j\\)\u003c/var\u003e-th ball \u003cvar\u003e\\((1\\leq j\\leq L_i)\\)\u003c/var\u003e in Bag \u003cvar\u003e\\(i\\)\u003c/var\u003e has a positive integer \u003cvar\u003e\\(a_{i,j}\\)\u003c/var\u003e written on it.\u003c/p\u003e\n \u003cp\u003eWe will pick out one ball from each bag.\u003cbr\u003e\n How many ways are there to pick the balls so that the product of the numbers written on the picked balls is \u003cvar\u003e\\(X\\)\u003c/var\u003e?\u003c/p\u003e\n \u003cp\u003eHere, we distinguish all balls, even with the same numbers written on them.\u003c/p\u003e\n\u003c/section\u003e"}},{"title":"Constraints","value":{"format":"MD","content":"\u003csection\u003e\n \u003cul\u003e\n \u003cli\u003e\u003cvar\u003e\\(N \\geq 2\\)\u003c/var\u003e\u003c/li\u003e\n \u003cli\u003e\u003cvar\u003e\\(L_i \\geq 2\\)\u003c/var\u003e\u003c/li\u003e\n \u003cli\u003eThe product of the numbers of balls in the bags is at most \u003cvar\u003e\\(10^5\\)\u003c/var\u003e: \u003cvar\u003e\\(\\displaystyle\\prod_{i\u003d1}^{N}L_i \\leq 10^5\\)\u003c/var\u003e.\u003c/li\u003e\n \u003cli\u003e\u003cvar\u003e\\(1 \\leq a_{i,j} \\leq 10^9\\)\u003c/var\u003e\u003c/li\u003e\n \u003cli\u003e\u003cvar\u003e\\(1 \\leq X \\leq 10^{18}\\)\u003c/var\u003e\u003c/li\u003e\n \u003cli\u003eAll values in input are integers.\u003c/li\u003e\n \u003c/ul\u003e\n\u003c/section\u003e"}},{"title":"Input","value":{"format":"MD","content":"\u003csection\u003e\n \u003cp\u003eInput is given from Standard Input in the following format:\u003c/p\u003e\n \u003cpre\u003e\u003cvar\u003e\\(N\\)\u003c/var\u003e \u003cvar\u003e\\(X\\)\u003c/var\u003e\n\u003cvar\u003e\\(L_1\\)\u003c/var\u003e \u003cvar\u003e\\(a_{1,1}\\)\u003c/var\u003e \u003cvar\u003e\\(a_{1,2}\\)\u003c/var\u003e \u003cvar\u003e\\(\\ldots\\)\u003c/var\u003e \u003cvar\u003e\\(a_{1,L_1}\\)\u003c/var\u003e\n\u003cvar\u003e\\(L_2\\)\u003c/var\u003e \u003cvar\u003e\\(a_{2,1}\\)\u003c/var\u003e \u003cvar\u003e\\(a_{2,2}\\)\u003c/var\u003e \u003cvar\u003e\\(\\ldots\\)\u003c/var\u003e \u003cvar\u003e\\(a_{2,L_2}\\)\u003c/var\u003e\n\u003cvar\u003e\\(\\vdots\\)\u003c/var\u003e\n\u003cvar\u003e\\(L_N\\)\u003c/var\u003e \u003cvar\u003e\\(a_{N,1}\\)\u003c/var\u003e \u003cvar\u003e\\(a_{N,2}\\)\u003c/var\u003e \u003cvar\u003e\\(\\ldots\\)\u003c/var\u003e \u003cvar\u003e\\(a_{N,L_N}\\)\u003c/var\u003e\n\u003c/pre\u003e\n\u003c/section\u003e"}},{"title":"Output","value":{"format":"MD","content":"\u003csection\u003e\n \u003cp\u003ePrint the answer.\u003c/p\u003e\n\u003c/section\u003e"}},{"title":"Sample 1","value":{"format":"MD","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 40\n3 1 8 4\n2 10 5\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e2\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003csection\u003e\n\u003c/section\u003e\u003csection\u003e\n \u003cp\u003eWhen choosing the \u003cvar\u003e\\(3\\)\u003c/var\u003e-rd ball in Bag \u003cvar\u003e\\(1\\)\u003c/var\u003e and \u003cvar\u003e\\(1\\)\u003c/var\u003e-st ball in Bag \u003cvar\u003e\\(2\\)\u003c/var\u003e, we have \u003cvar\u003e\\(a_{1,3} \\times a_{2,1} \u003d 4 \\times 10 \u003d 40\\)\u003c/var\u003e.\u003cbr\u003e\n When choosing the \u003cvar\u003e\\(2\\)\u003c/var\u003e-nd ball in Bag \u003cvar\u003e\\(1\\)\u003c/var\u003e and \u003cvar\u003e\\(2\\)\u003c/var\u003e-nd ball in Bag \u003cvar\u003e\\(2\\)\u003c/var\u003e, we have \u003cvar\u003e\\(a_{1,2} \\times a_{2,2} \u003d 8 \\times 5 \u003d 40\\)\u003c/var\u003e.\u003cbr\u003e\n There are no other ways to make the product \u003cvar\u003e\\(40\\)\u003c/var\u003e, so the answer is \u003cvar\u003e\\(2\\)\u003c/var\u003e.\u003c/p\u003e\n\u003c/section\u003e"}},{"title":"Sample 2","value":{"format":"MD","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 200\n3 10 10 10\n3 10 10 10\n5 2 2 2 2 2\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e45\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003csection\u003e\n\u003c/section\u003e\u003csection\u003e\n \u003cp\u003eNote that we distinguish all balls, even with the same numbers written on them.\u003c/p\u003e\n\u003c/section\u003e"}},{"title":"Sample 3","value":{"format":"MD","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 1000000000000000000\n2 1000000000 1000000000\n2 1000000000 1000000000\n2 1000000000 1000000000\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\u003csection\u003e\n\u003c/section\u003e\u003csection\u003e\n \u003cp\u003eThere may be no way to make the product \u003cvar\u003e\\(X\\)\u003c/var\u003e.\u003c/p\u003e\n\u003c/section\u003e"}}]}