#P17155. [ICPC 2017 Xi'an R] LOL
[ICPC 2017 Xi'an R] LOL
Problem Description
friends play LOL together. Everyone should BAN one character and PICK one character. The enemy should BAN characters and PICK characters. All these heroes must be different.
Everyone can BAN any heroes by their personal wishes. But they can only PICK heroes which they have bought.
Suppose the enemy can PICK or BAN any heroes. How many different ways are there satisfying the conditions?
For example, a valid way is:
- Player : picks hero , bans hero
- Player : picks hero , bans hero
- Player : picks hero , bans hero
- Player : picks hero , bans hero
- Player : picks hero , bans hero Enemies pick heroes , ban heroes .
Input Format
The input contains multiple test cases (no more than ).
In each test case, there are strings , respectively whose lengths are . For the -th person, if he has bought the -th hero, the -th character of is '', or '' if not. The total number of heroes is exactly .
Output Format
For each test case, print the answer mod in a single line.
0110011100011001001100011110001110001110001010010111111110101010010011010000110100011001001111101011
1000111101111110110100001101001101010001111001001011110001111110101000011101000001011100001001011010
0100101100011110011100110110011100111100010010011001111110101111111000000110001110000110001100001110
1110010101010001000110100011101010001010000110001111111110101010000000001111001110110101110000010011
1000010011111110001101100000101001110100011000111010011111110110111010011111010110101111011111011011
515649254