1638: 路径计数(过河卒简化版)

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:37 Solved:5

Description

一个 lns="http://www.w3.org/1998/Math/MathML">N \times N 的网格,你一开始在 lns="http://www.w3.org/1998/Math/MathML">(1,1),即左上角。每次只能移动到下方相邻的格子或者右方相邻的格子,问到达 lns="http://www.w3.org/1998/Math/MathML">(N,N),即右下角有多少种方法。

但是这个问题太简单了,所以现在有 lns="http://www.w3.org/1998/Math/MathML">M 个格子上有障碍,即不能走到这 lns="http://www.w3.org/1998/Math/MathML">M 个格子上。

Input

输入文件第 lns="http://www.w3.org/1998/Math/MathML">1 行包含两个非负整数 lns="http://www.w3.org/1998/Math/MathML">N,M,表示了网格的边长与障碍数。

接下来 lns="http://www.w3.org/1998/Math/MathML">M 行,每行两个不大于 lns="http://www.w3.org/1998/Math/MathML">N 的正整数 lns="http://www.w3.org/1998/Math/MathML">x, y。表示坐标 lns="http://www.w3.org/1998/Math/MathML">(x, y) 上有障碍不能通过,且有 lns="http://www.w3.org/1998/Math/MathML">1≤x, y≤n,且 lns="http://www.w3.org/1998/Math/MathML">x, y 至少有一个大于 lns="http://www.w3.org/1998/Math/MathML">1,并请注意障碍坐标有可能相同。

Output

一个非负整数,路径总数

Sample Input Copy

3 1
3 1

Sample Output Copy

5

HINT

过河卒简化版