atcoder#AGC016E. [AGC016E] Poor Turkeys
[AGC016E] Poor Turkeys
Score : points
Problem Statement
There are turkeys. We number them from through .
men will visit here one by one. The -th man to visit will take the following action:
- If both turkeys and are alive: selects one of them with equal probability, then eats it.
- If either turkey or is alive (but not both): eats the alive one.
- If neither turkey nor is alive: does nothing.
Find the number of pairs () such that the following condition is held:
- The probability of both turkeys and being alive after all the men took actions, is greater than .
Constraints
Input
Input is given from Standard Input in the following format:
Output
Print the number of pairs () such that the condition is held.
3 1
1 2
2
satisfy the condition.
4 3
1 2
3 4
2 3
1
satisfies the condition. Both turkeys and are alive if:
- The first man eats turkey .
- The second man eats turkey .
- The third man does nothing.
3 2
1 2
1 2
0
10 10
8 9
2 8
4 6
4 9
7 8
2 8
1 8
3 4
3 4
2 7
5