atcoder#ABC216F. [ABC216F] Max Sum Counting
[ABC216F] Max Sum Counting
Score : points
Problem Statement
Given are sequences of integers each: and . Find the number of non-empty subsets of that satisfy the following condition:
- .
Since the count can be enormous, print it modulo .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the number of subsets that satisfy the condition in the Problem Statement, modulo .
2
3 1
1 2
2
has three subsets: , , and .
- For , we have and .
- For , we have and .
- For , we have and .
Thus, the condition is satisfied by two subsets: and .
2
1 1
2 2
0
There may be no subsets that satisfy the condition.
20
1937 3980 2689 1208 3640 1979 581 2271 4229 3948 3708 1522 4161 4661 3797 96 3388 3395 2920 2247
4485 2580 174 1156 3770 3396 3558 3500 3494 479 269 3383 1230 1711 3545 3919 134 475 3796 1017
476