#P9737. [COCI 2022/2023 #2] Lampice
[COCI 2022/2023 #2] Lampice
Problem Description
Teo’s balcony is a rectangular platform with length and width . There are colored lights on it. The color of each light is represented by a number from . For each color, there are exactly lights, and all their coordinates are positive integers.
Teo considers a region on the balcony to be good if and only if:
-
This region is a rectangle, and all its sides are parallel to the sides of the balcony.
-
For the two lights of each color, either both are inside the region, or both are outside the region.
-
The coordinates of the top-left corner and the bottom-right corner of the region are both integers.
-
The length and width of the region are both at least .
Now Teo wants you to find how many good regions there are on his balcony.
Note: the bottom-left corner is , and the top-right corner is .
Input Format
The first line contains three integers , , (), representing the length and width of the balcony, and the number of light colors.
The next lines each contain four integers , , , . The -th line gives the coordinates of the two lights of color .
Output Format
One line containing one integer, the number of good regions.
2 2 1
0 0 1 2
3
3 3 0
36
3 3 5
0 0 0 0
0 0 1 3
0 0 3 1
1 3 3 1
1 3 3 1
7
Hint
| Score | Special Properties | |
|---|---|---|
| For each color, | ||
| , | ||
| None |
The full score for this problem is points.
Translated by ChatGPT 5