8168: Blocked Billboard II

内存限制:128 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:1 通过:1

题目描述

Bessie the cow used to have such a nice view from her barn, looking across road at a set of two billboards advertising delicious looking cow feed. Unfortunately, one of these billboards has recently been updated so it now advertises "Farmer Larry's Lawnmowers". Bessie is not a fan of lawnmowers since their only purpose, as far as she can tell, is cutting back the grass in her field that she finds so tasty (if you haven't noticed, much of Bessie's thought process revolves around food).

Fortunately, the remaining cow feed billboard is situated in front of the lawnmower billboard, potentially obscuring it.

Bessie, determined to remove the offensive lawnmower billboard completely from her view, hatches a risky plan. She plans to steal a large rectangular tarp from the barn and sneak out late at night to cover the remaining portion of the lawnmower billboard, so that she can no longer see any part of it.

Given the locations of the two billboards, please help Bessie compute the minimum area of the tarp she will need. Since the only tarps available in the barn are rectangular in size, Bessie observes that she may conceivably need a tarp whose area is slightly larger than the exposed area of the lawnmower billboard, as illustrated in the example below. The tarp may only be placed such that its sides are parallel to those of the other billboards (i.e., it cannot be "tilted").

奶牛贝茜曾经从农场中向外看去,可以看到两个刊登着美味的牛饲料广告的广告牌,这令她非常满意。

不幸的是,其中一个广告牌最近已更新,现在刊登着广告“农民拉里的割草机”。

但是贝茜可不喜欢割草机,这些割草机只会把她爱吃的草割的一干二净。

幸运的是,剩下的牛饲料广告牌位于割草机广告牌的前面,有可能将其遮挡住。

贝茜希望这个讨厌的割草机广告牌能够完全从自己的视线中消失,并为此制定了一个冒险计划。

她计划从谷仓里偷一个大的矩形防水布,并在深夜偷偷溜走,用它覆盖割草机广告牌的其余部分,使得她能完全看不到割草机广告牌。

给定两个广告牌的位置,请帮助贝茜计算她所需要的防水布的最小面积。

由于谷仓中只有矩形的防水布,因此贝茜发现为了将割草机广告牌完全遮盖,所需的防水布面积可能会大于割草机广告牌的裸露面积,如下例所示。

防水布在放置时,其边必须与广告牌的边平行,即不能倾斜放置。

输入格式

The first line of input contains four space-separated integers: x1 y1 x2 y2, where (x1,y1) and (x2,y2) are the coordinates of the lower-left and upper-right corners of the lawnmower billboard in Bessie's 2D field of view. The next line contains four more integers, similarly specifying the lower-left and upper-right corners of the cow feed billboard. The cow feed billboard may obscure all, some, or none of the lawnmower billboard. All coordinates are in the range -1000 to +1000.

第一行包含四个整数 x1,y1,x2,y2,其中 (x1,y1)和 (x2,y2)表示割草机广告牌的左下角和右上角坐标。

第二行按照如上形式,包含四个整数,表示牛饲料广告牌的左下角和右上角坐标。

牛饲料广告牌可能完全遮盖了割草机广告牌,或部分遮盖了割草机广告牌,也可能完全没有遮盖割草机广告牌。


输出格式

Please output the minimum area of the tarp Bessie needs to use to cover part of the lawnmower billboard so that it becomes completely obscured.
输出用来遮盖割草机广告牌的防水布的最小面积。

输入样例 复制

2 1 7 4
5 -1 10 3

输出样例 复制

15