#CCBCMCHIN0000055. Hình vuông nhỏ nhất chứa hai hình chữ nhật (Minimal Square)
Hình vuông nhỏ nhất chứa hai hình chữ nhật (Minimal Square)
Minimal Square
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given two identical rectangles with positive integer sides, find the smallest square area containing both. The rectangles may be rotated by 90 degrees, may touch, but cannot overlap; all edges remain axis-aligned.
Input
One line contains positive integers .
Output
Print one integer: the minimum square area.
Subtasks
-
Subtask 1 (20 points): 1 <= a,b <= 10.
-
Subtask 2 (30 points): 1 <= a,b <= 50.
-
Subtask 3 (50 points): 1 <= a,b <= 100.
Examples
Example 1
Input
3 2
Output
16
Explanation
For this input, the case-specific computation and the required exact output are shown above. The required square side is 4, giving area 16.
Example 2
Input
4 7
Output
64
Explanation
For this input, the case-specific computation and the required exact output are shown above. The square side is 8, giving area 64.