#P5982. [PA 2019] Trzy kule
[PA 2019] Trzy kule
Description
For two binary strings and of length , define their distance as $\operatorname{d(a,b)}=|a_1-b_1|+|a_2-b_2|+...+|a_n-b_n|$.
Given three binary strings of length and three non-negative integers , ask how many binary strings of length satisfy that at least one of the following three inequalities holds: , , .
Input Format
The first line contains a positive integer .
The second line contains a non-negative integer , followed by a binary string of length .
The third line contains a non-negative integer , followed by a binary string of length .
The fourth line contains a non-negative integer , followed by a binary string of length .
Output Format
Output one line containing one integer, which is the number of valid modulo .
5
2 10110
0 11010
1 00000
19
Hint
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号