#P1958. 上学路线
上学路线
Description
The streets in your city form a grid, with north–south streets and east–west streets. The north–south streets are numbered from west to east as to , and the east–west streets are numbered from south to north as to . The intersection of north–south street and east–west street is denoted as .
You live at , and the school is at . You ride a bicycle to school, which can travel only along the streets, and to minimize time you are only allowed to move east or north.
Now intersections are under construction, , , …, , and these intersections are closed to traffic.
How many different routes are there to go to school?
Input Format
The first line contains two integers and , with . It is guaranteed that the school is not at , and that the destination is reachable.
The second line contains an integer , indicating that there are intersections under construction ().
The next lines each contain two integers , giving the locations of the closed intersections.
Output Format
Output a single integer, the total number of routes from to .
5 4
3
2 2
2 3
4 2
5
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号