{"problem":{"name":"Ball Coloring","description":{"content":"There are $N$ bags, each containing two white balls. The $i$\\-th box contains two balls with integers $x_i$ and $y_i$ written on them, respectively. For each of these bags, you will paint one of the b","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc073_c"},"statements":[{"statement_type":"Markdown","content":"There are $N$ bags, each containing two white balls. The $i$\\-th box contains two balls with integers $x_i$ and $y_i$ written on them, respectively.\nFor each of these bags, you will paint one of the balls red, and paint the other blue.\nAfterwards, the $2N$ balls will be classified according to color.\nThen, we will define the following:\n\n*   $R_{max}$: the maximum integer written on a ball painted in red\n*   $R_{min}$: the minimum integer written on a ball painted in red\n*   $B_{max}$: the maximum integer written on a ball painted in blue\n*   $B_{min}$: the minimum integer written on a ball painted in blue\n\nFind the minimum possible value of $(R_{max} - R_{min}) \\times (B_{max} - B_{min})$.\n\n## Constraints\n\n*   $1 ≤ N ≤ 200,000$\n*   $1 ≤ x_i, y_i ≤ 10^9$\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$\n$x_1$ $y_1$\n$x_2$ $y_2$\n:\n$x_N$ $y_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc073_c","tags":[],"sample_group":[["3\n1 2\n3 4\n5 6","15\n\nThe optimal solution is to paint the balls with $x_1$, $x_2$, $y_3$ red, and paint the balls with $y_1$, $y_2$, $x_3$ blue."],["3\n1010 10\n1000 1\n20 1020","380"],["2\n1 1\n1000000000 1000000000","999999998000000001"]],"created_at":"2026-03-03 11:01:13"}}