主页
题目
状态
排名
OI排名
统计
题解
请登录
常用链接
AOJ考试平台
老赵的Gitee代码
编译原理模拟考试平台
Java技术手册
FCC网站
菜鸟网
在线工具箱
字节豆包GPT
代码可视化
力扣网
牛客网
洛谷
杭电OJ
CodeForce
隐藏编译器
Problem H: Calabash and Landlord
上一题
正确率: $100.00\%$
下一题
Time Limit
$1$ 秒/Second(s)
Memory Limit
$512$ 兆字节/Megabyte(s)
提交总数
$1$
正确数量
$1$
"
裁判形式
标准裁判/Standard Judge
我的状态
尚未尝试
难度
分类标签
×
为本题添加算法分类(请不要超过5个)
当前分类(单击移除):
单击选择分类:
Description
<span style="font-family:Merriweather, serif;font-size:18px;background-color:rgba(210, 210, 255, 0.5);">Calabash is the servant of a landlord. The landlord owns a piece of land, which can be regarded as an infinite 2D plane. </span><br /> <br /> <span style="font-family:Merriweather, serif;font-size:18px;background-color:rgba(210, 210, 255, 0.5);">One day the landlord set up two orthogonal rectangular-shaped fences on his land. He asked Calabash a simple problem: how many nonempty connected components is my land divided into by these two fences, both finite and infinite? Calabash couldn't answer this simple question. Please help him! </span><br /> <br /> <span style="font-family:Merriweather, serif;font-size:18px;background-color:rgba(210, 210, 255, 0.5);">Recall that a connected component is a maximal set of points not occupied by the fences, and every two points in the set are reachable without crossing the fence. </span>
Input
<span style="font-family:Merriweather, serif;font-size:18px;background-color:rgba(210, 210, 255, 0.5);">The first line of input consists of a single integer </span>T<span style="font-family:Merriweather, serif;font-size:18px;background-color:rgba(210, 210, 255, 0.5);"> </span>(1≤T≤10000)<span style="font-family:Merriweather, serif;font-size:18px;background-color:rgba(210, 210, 255, 0.5);">, the number of test cases. </span><br /> <br /> <span style="font-family:Merriweather, serif;font-size:18px;background-color:rgba(210, 210, 255, 0.5);">Each test case contains two lines, specifying the two rectangles. Each line contains four integers </span>x1,y1,x2,y2<span style="font-family:Merriweather, serif;font-size:18px;background-color:rgba(210, 210, 255, 0.5);"> </span>(0≤x1,y1,x2,y2≤109,x1<x2,y1<y2)<span style="font-family:Merriweather, serif;font-size:18px;background-color:rgba(210, 210, 255, 0.5);">, where </span>(x1,y1),(x2,y2)<span style="font-family:Merriweather, serif;font-size:18px;background-color:rgba(210, 210, 255, 0.5);"> are the Cartesian coordinates of two opposite vertices of the rectangular fence. The edges of the rectangles are parallel to the coordinate axes. The edges of the two rectangles may intersect, overlap, or even coincide. </span>
Output
<span style="font-family:Merriweather, serif;font-size:18px;background-color:rgba(210, 210, 255, 0.5);">For each test case, print the answer as an integer in one line.</span>
Sample Input
复制
3 0 0 1 1 2 2 3 4 1 0 3 2 0 1 2 3 0 0 1 1 0 0 1 1
Sample Output
复制
3 4 2
AOJ
Please Login