All Tracks Math Problem

SNAPSHOT
/

Algorithms, Mathamatics

Problem
Editorial
Analytics

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

SAMPLE INPUT
2
3 3
2 2

4 4
2 2 
SAMPLE OUTPUT
4
16
Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB

Best Submission

Similar Problems

Contributors

This Problem was Asked in

Initializing Code Editor...
Notifications
View All Notifications

?