#P11011. 「ALFR Round 4」A 点的覆盖
「ALFR Round 4」A 点的覆盖
Problem Description
In the 2D Cartesian coordinate system, if both the -coordinate and the -coordinate of a point are integers, we call it an integer point. Given a rectangle whose vertices are all integer points and whose sides are parallel to the coordinate axes, and given integer points inside rectangle (possibly on its boundary), ask how many sub-rectangles of satisfy:
-
All vertices are integer points.
-
All four sides are parallel to a coordinate axis.
-
They can completely cover (boundary is allowed) .
In this problem, the length or width of a rectangle may be .
Input Format
The first line contains five integers, which are the number of given integer points , the -coordinate of the upper-left vertex of rectangle , the -coordinate of the upper-left vertex, the -coordinate of the lower-right vertex, and the -coordinate of the lower-right vertex.
Lines to : in line , two integers give the -coordinate and -coordinate of .
Output Format
Output one integer in one line, representing the answer modulo .
3 1 5 6 1
2 3
2 4
4 2
24
Hint
| Subtask | Score | Constraints |
|---|---|---|
| , the coordinates of all points are less than | ||
| All points except the vertices of have the same -coordinate | ||
| - |
For of the testdata, , all point coordinates are positive integers and less than .
Translated by ChatGPT 5