All submissions for this problem are available.
Alice has stuck a huge rectangular white sheet on a board. The sheet has length 5000cm and width 5000cm. She gives Bob 4 integers: l1, w1, l2, and w2. Bob should draw two rectagles, R1 and R2 on the sheet, such that all the sides of both the rectangles are parallel to some side of the white sheet. Also, R1 should have length l1 and width w1, and R2 should have length l2 and width w2. He may draw them wherever he wants, as long as both the rectangles are wholly inside the white sheet. The two rectangles can overlap. Then, Bob should fully colour these two rectangles Red (interiors of the rectangles as well). His Score is the total area which is coloured Red. He wants to find out the minimum and maximum Scores that he can acheive. Please help Bob find these out. Note that the length and width cannot be interchanged.
- The first line of input contains a single integer T denoting number of test cases.
- The only line of each test case contains four integers: l1, w1, l2, and w2.
- For each test case, output two integers in a line corresponding to the minimum and maximum Scores achievable.
- 1 ≤ T ≤ 105
- 1 ≤ l1, w1, l2, w2 ≤ 1000
- Subtask 1 (20 points):
- l1 will be equal to l2, and w1 will be equal to w2
- Subtask 2 (80 points):
- No such constraints.
Input: 2 10 5 5 10 10 5 10 5 Output: 75 100 50 100
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions