#P3271. [JLOI2016] 方
[JLOI2016] 方
Description
God said, do not be round, be square; thus this problem.
Since we should be square, and preferably as square as possible, God sent us to find squares. We are placed on a grid with rows and columns, containing grid points. Our task is to count how many squares can be formed such that all four vertices are grid points.
However, the problem is too hard because there are too many points, so God deleted of these points. With fewer points, the problem becomes easier. Now, how many squares can be formed from the remaining grid points?
Input Format
The first line contains three integers , representing the number of rows, the number of columns, and the number of vertices that cannot be used. It is guaranteed that , .
We number the rows from top to bottom by integers to , and the columns from left to right by to .
The next lines each contain two integers , indicating that the grid point at row , column is deleted.
It is guaranteed that , , , and no grid point is repeated.
Output Format
Output a single positive integer: the number of squares modulo ().
2 2 4
1 0
1 2
0 1
2 1
1
Hint
Translated by ChatGPT 5
京公网安备 11011102002149号