{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"\u003chtml\u003e\n \u003chead\u003e\u003c/head\u003e\n \u003cbody\u003e\n \u003cp\u003eAlice and Bob now love to play a card game. Everyone is starting n cards, each card has no more than m attribute. Now they need finish Q tasks, each task will require everyone to give a card, and then make up the attribute types that the task demands (e.g. the task required attributes A, B, C, Alice’s card contains A B and Bob’s card contains B, C. they can use this union to finish the task).\u003cbr\u003e For each task, How many ways that Alice and Bob can do this task.\u003c/p\u003e\n \u003c/body\u003e\n\u003c/html\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003chtml\u003e\n \u003chead\u003e\u003c/head\u003e\n \u003cbody\u003e\n \u003cp\u003ehere are T cases. (T\u0026lt;\u003d20) (about 5 test cases n\u0026gt;\u003d1000 m\u0026gt;\u003d12 Q\u0026gt;\u003d1000)\u003cbr\u003e For each test case.The first line contains two integers n,m(n\u0026lt;\u003d100000, m\u0026lt;\u003d18), which indicates the number of cards which each one has and total attributes.\u003cbr\u003e The next line contain n binary numbers indicates the cards Alice has. The ith binary number m_i indicates the attributes each card have. (m_i \u0026lt;2^18)\u003cbr\u003e (if m_i \u003d 10011 , this card has the first, second and fifth attrtbutes)\u003cbr\u003e The next line contain n binary numbers indicates the cards Bob has.\u003cbr\u003e Then contain one integer Q which is the number of Tasks.\u003cbr\u003e Then next Q lines, each contain one binary number q_i which indicates the attributes they need to make. (qi \u0026lt; 2^18)\u003c/p\u003e\n \u003c/body\u003e\n\u003c/html\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003chtml\u003e\n \u003chead\u003e\u003c/head\u003e\n \u003cbody\u003e\n \u003cp\u003eFor each test case, you first output one line “Case #%d:”\u003cbr\u003e Then output q lines, each line contains one which indicates the ways they can finish this task.\u003c/p\u003e\n \u003c/body\u003e\n\u003c/html\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre\u003e1\n4 4\n1001 11 1100 1000\n1110 1001 10 100\n2\n1100\n111\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre\u003eCase #1:\n2\n1\u003c/pre\u003e"}},{"title":"Hint","value":{"format":"HTML","content":"\u003chtml\u003e\n \u003chead\u003e\u003c/head\u003e\n \u003cbody\u003e\u003c/body\u003e\n\u003c/html\u003e"}}]}