91. Rectangle From Two Corners
Core1000 ms256 MBSolved by 0%
A rectangle is described by two opposite corners, given as x1 y1 x2 y2.
The corners may be given in any order, so the second is not necessarily to the upper right
of the first.
Print the rectangle's area and its perimeter, separated by a single space.
Constraints - `-1000000 ≤ each coordinate ≤ 1000000`
Input
A single line containing four integers x1 y1 x2 y2 — two opposite corners.
Output
Print two integers on one line, separated by a single space — the area, then the perimeter.
Input0 0 4 3
Output12 14
Notehas the corners in the expected order
Input4 3 0 0
Output12 14
Notehas the corners reversed, and must give the same answer
Hint 1Approach
Hint 2Approach
Hint 3Pseudocode
Hint 4Full solution