#K40177. Rectangle Area and Pumpkin Count
Rectangle Area and Pumpkin Count
Rectangle Area and Pumpkin Count
You are given two diagonally opposite corners of a rectangle and a list of points representing the positions of pumpkins. Your task is to:
- Calculate the area of the rectangle using the formula $$\text{Area} = |x_1 - x_2| \times |y_1 - y_2|$$, and round the result to one decimal place.
- Count the number of pumpkins that lie inside or on the boundary of the rectangle.
Note: The rectangle's sides are parallel to the coordinate axes. A pumpkin is considered inside if its x-coordinate is between \(\min(x_1, x_2)\) and \(\max(x_1, x_2)\), and similarly for the y-coordinate.
inputFormat
The input is given via standard input (stdin) and consists of:
- A line containing four integers:
x1 y1 x2 y2
, the coordinates of two opposite corners of the rectangle. - A line containing a single integer
n
indicating the number of pumpkins. n
subsequent lines each containing two integerspx py
representing the coordinates of a pumpkin.
outputFormat
Output via standard output (stdout) a single line with two values separated by a space:
- The area of the rectangle rounded to one decimal place.
- The count of pumpkins inside or on the boundary of the rectangle.
1 1 4 3
5
2 2
3 2
4 1
1 3
5 5
6.0 4