{"trustable":true,"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":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eWe have \u003cvar\u003e\\(N\\)\u003c/var\u003e switches with \"on\" and \"off\" state, and \u003cvar\u003e\\(M\\)\u003c/var\u003e bulbs. The switches are numbered \u003cvar\u003e\\(1\\)\u003c/var\u003e to \u003cvar\u003e\\(N\\)\u003c/var\u003e, and the bulbs are numbered \u003cvar\u003e\\(1\\)\u003c/var\u003e to \u003cvar\u003e\\(M\\)\u003c/var\u003e.\u003c/p\u003e\r\n\u003cp\u003eBulb \u003cvar\u003e\\(i\\)\u003c/var\u003e is connected to \u003cvar\u003e\\(k_i\\)\u003c/var\u003e switches: Switch \u003cvar\u003e\\(s_{i1}\\)\u003c/var\u003e, \u003cvar\u003e\\(s_{i2}\\)\u003c/var\u003e, \u003cvar\u003e\\(...\\)\u003c/var\u003e, and \u003cvar\u003e\\(s_{ik_i}\\)\u003c/var\u003e. It is lighted when the number of switches that are \"on\" among these switches is congruent to \u003cvar\u003e\\(p_i\\)\u003c/var\u003e modulo \u003cvar\u003e\\(2\\)\u003c/var\u003e.\u003c/p\u003e\r\n\u003cp\u003eHow many combinations of \"on\" and \"off\" states of the switches light all the bulbs?\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Constraints","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cul\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 \\leq N, M \\leq 10\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 \\leq k_i \\leq N\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(1 \\leq s_{ij} \\leq N\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(s_{ia} \\neq s_{ib} (a \\neq b)\\)\u003c/var\u003e\u003c/li\u003e\r\n\u003cli\u003e\u003cvar\u003e\\(p_i\\)\u003c/var\u003e is \u003cvar\u003e\\(0\\)\u003c/var\u003e or \u003cvar\u003e\\(1\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003cli\u003eAll values in input are integers.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003c/section\u003e\r\n"}},{"title":"Input","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003eInput is given from Standard Input in the following format:\u003c/p\u003e\r\n\u003cpre\u003e\u003cvar\u003e\\(N\\)\u003c/var\u003e \u003cvar\u003e\\(M\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(k_1\\)\u003c/var\u003e \u003cvar\u003e\\(s_{11}\\)\u003c/var\u003e \u003cvar\u003e\\(s_{12}\\)\u003c/var\u003e \u003cvar\u003e\\(...\\)\u003c/var\u003e \u003cvar\u003e\\(s_{1k_1}\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(:\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(k_M\\)\u003c/var\u003e \u003cvar\u003e\\(s_{M1}\\)\u003c/var\u003e \u003cvar\u003e\\(s_{M2}\\)\u003c/var\u003e \u003cvar\u003e\\(...\\)\u003c/var\u003e \u003cvar\u003e\\(s_{Mk_M}\\)\u003c/var\u003e\r\n\u003cvar\u003e\\(p_1\\)\u003c/var\u003e \u003cvar\u003e\\(p_2\\)\u003c/var\u003e \u003cvar\u003e\\(...\\)\u003c/var\u003e \u003cvar\u003e\\(p_M\\)\u003c/var\u003e\r\n\u003c/pre\u003e\r\n\r\n\u003c/section\u003e\r\n"}},{"title":"Output","value":{"format":"HTML","content":"\r\n\u003csection\u003e\r\n\u003cp\u003ePrint the number of combinations of \"on\" and \"off\" states of the switches that light all the bulbs.\u003c/p\u003e\r\n\u003c/section\u003e\r\n"}},{"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 2\r\n2 1 2\r\n1 2\r\n0 1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cul\u003e\r\n\u003cli\u003eBulb \u003cvar\u003e\\(1\\)\u003c/var\u003e is lighted when there is an even number of switches that are \"on\" among the following: Switch \u003cvar\u003e\\(1\\)\u003c/var\u003e and \u003cvar\u003e\\(2\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003cli\u003eBulb \u003cvar\u003e\\(2\\)\u003c/var\u003e is lighted when there is an odd number of switches that are \"on\" among the following: Switch \u003cvar\u003e\\(2\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003cp\u003eThere are four possible combinations of states of (Switch \u003cvar\u003e\\(1\\)\u003c/var\u003e, Switch \u003cvar\u003e\\(2\\)\u003c/var\u003e): (on, on), (on, off), (off, on) and (off, off). Among them, only (on, on) lights all the bulbs, so we should print \u003cvar\u003e\\(1\\)\u003c/var\u003e.\u003c/p\u003e\r\n\u003c/section\u003e\r\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 3\r\n2 1 2\r\n1 1\r\n1 2\r\n0 0 1\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003cul\u003e\r\n\u003cli\u003eBulb \u003cvar\u003e\\(1\\)\u003c/var\u003e is lighted when there is an even number of switches that are \"on\" among the following: Switch \u003cvar\u003e\\(1\\)\u003c/var\u003e and \u003cvar\u003e\\(2\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003cli\u003eBulb \u003cvar\u003e\\(2\\)\u003c/var\u003e is lighted when there is an even number of switches that are \"on\" among the following: Switch \u003cvar\u003e\\(1\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003cli\u003eBulb \u003cvar\u003e\\(3\\)\u003c/var\u003e is lighted when there is an odd number of switches that are \"on\" among the following: Switch \u003cvar\u003e\\(2\\)\u003c/var\u003e.\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003cp\u003eSwitch \u003cvar\u003e\\(1\\)\u003c/var\u003e has to be \"off\" to light Bulb \u003cvar\u003e\\(2\\)\u003c/var\u003e and Switch \u003cvar\u003e\\(2\\)\u003c/var\u003e has to be \"on\" to light Bulb \u003cvar\u003e\\(3\\)\u003c/var\u003e, but then Bulb \u003cvar\u003e\\(1\\)\u003c/var\u003e will not be lighted. Thus, there are no combinations of states of the switches that light all the bulbs, so we should print \u003cvar\u003e\\(0\\)\u003c/var\u003e.\u003c/p\u003e\r\n\u003c/section\u003e\r\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\u003e5 2\r\n3 1 2 5\r\n2 2 3\r\n1 0\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e8\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\r\n\u003csection\u003e\r\n\r\n\r\n\u003c/section\u003e\r\n\r\n\u003csection\u003e\r\n\u003c/section\u003e\r\n"}}]}