Sample Testcase - Grand Temple

I don’t understand the sample testcase given below. Can you please explain why sample input and explanation data differ?
Sample Input has (1,1) (2,4) (5,2) but explanation is for (2,2), (2,4), (5,2), (5,4).

Sample Input

3

1 1

2 4

5 2

Sample Output

2

Explanation

Area between (2,2), (2,4), (5,2), (5,4)

(For the largest possible region found the area will be calculated from the edge next to the left edge, the edge above the bottom edge, the topmost edge and the rightmost edge i.e for the region (2,2) , (2,4) , (5,2) , (5,4) the actual area will be considered from (3,2), (3,4), (5,2), (5,4) respectively. Try to draw the diagram and you will realize the modified picture of the area)

Hey @srbh453
You are provided with the coordinated through which 2 rivers flow- one horizontally and the other one is flowing vertically. You have to build a temple provided the condition that the temple must be enclosed with a river on all 4 sides. You are supposed to find the max possible area for the temple.
For every possible area you must have a rectangle which is enclosed by different rivers on each side.

Sample Input

3
1 1
2 4
5 2

We have these 3 points through which rivers flow horizontally as well as vertically.
For the given test case we found that (2,2), (2,4), (5,2), (5,4) these are the 4 points which will give us the maximum area. We also need to assume that the width of the river is 1 unit.
So, while calculating the area we need to ignore the area covered by river i.e. the area will be calculated from the edge next to the left edge, the edge above the bottom edge, the topmost edge and the rightmost edge, therefore for the region (2,2) , (2,4) , (5,2) , (5,4) the actual area will be considered to be (3,2), (3,4), (5,2), (5,4) after removal of the area covered by the river. Thus, giving the maximum area as 2 units.

Note:
Observe the figure carefully, you have to subtract 1 from both dx and dy before multiplication.

Hope, this would help.

Thank you! I understand!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.