#P1176. 路径计数2
路径计数2
Description
On an grid, you start at , the top-left corner. Each move, you may only go to the adjacent cell below or to the adjacent cell to the right. How many ways are there to reach , the bottom-right corner?
However, this problem is too simple, so now there are cells with obstacles, meaning you cannot step on these cells.
Input Format
The first line contains two non-negative integers , representing the side length of the grid and the number of obstacles.
Then follow lines, each containing two positive integers that are not greater than . This means there is an obstacle at coordinate that cannot be passed, with , and at least one of is greater than . Note that obstacle coordinates may be the same.
Output Format
A non-negative integer, which is the result of the answer .
3 1
3 1
5
Hint
For of the testdata, .
For of the testdata, .
For of the testdata, .
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号