SNAPSHOT
Practice
2.3 (3 votes)
Algorithms
Open
Approved
Medium
Mathamatics
Problem
21% Success 115 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code

My friend has just got his seperate room. He decided to paint a wall of the room with multiple colors. For this purpose he has divided the wall into a grid of M X N. He has already reserved one cell for our beautiful snapshot that was taken when we were kids.

He wants to paint the remaining portion of the wall in a certain manner. He is provided with infinite L shaped tromino blocks (one for each color). Refer pictures for better understanding

enter image description here

He wants to calculate the maximum square area that contains the snap and can be painted using these tromino blocks without any overlaps.

INPUT :
The first line of the input contains the number of test cases T. T test cases follow. first line of every test case contains 2 space separated integers N and M and the second line contains 2 space separated integers X and Y - coordinates of the SNAPSHOT

OUTPUT :
The maximum square area asked above

CONSTRAINTS :
T <= 10^5
N,M <=10^9
X<=N,Y <=M

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
1 votes
Tags:
MathematicsMediumOpenApprovedMathamatics
Points:30
1 votes
Tags:
Medium
Points:30
Tags:
Medium