#abc265e. E - Warp
E - Warp
Score : points
问题描述
Takahashi 在一个二维平面上的原点位置。
他将重复进行 次传送。每次传送时,他会执行以下三种移动之一:
- 从当前坐标 移动到
- 从当前坐标 移动到
- 从当前坐标 移动到
在平面上有 个障碍点 ;他不能传送到这些坐标位置。
请计算经过 次传送后,有多少种可能的路径,并以 取模的结果给出路径总数。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Takahashi is at the origin of a two-dimensional plane.
Takahashi will repeat teleporting times. In each teleportation, he makes one of the following moves:
- Move from the current coordinates to
- Move from the current coordinates to
- Move from the current coordinates to
There are obstacles on points on the plane; he cannot teleport to these coordinates.
How many paths are there resulting from the teleportations? Find the count modulo .
Constraints
- , , and are distinct.
- are distinct.
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
2 2
1 1 1 2 1 3
1 2
2 2
Sample Output 1
5
The following paths are possible:
Sample Input 2
10 3
-1000000000 -1000000000 1000000000 1000000000 -1000000000 1000000000
-1000000000 -1000000000
1000000000 1000000000
-1000000000 1000000000
Sample Output 2
0
Sample Input 3
300 0
0 0 1 0 0 1
Sample Output 3
292172978
update @ 2024/3/10 11:12:40