``````//左上角坐标(i, j), 右下角坐标(x, y)

//矩形1(i1, j1)(x1, y1), 矩形2(i2, j2)(x2, y2)

i =  max(i1, i2);
j =  max(j1, j2);
x =  min(x1, x2);
y =  min(y1, y2);
``````

``````if(i<x||j<y)
printf("不相交\n");
else if(i==x&&j==y)
printf("相交与一点\n");
else if(i==x||j==y)
printf("相交与一条直线\n");
else
printf("存在相交矩形\n");
``````

``````//左上角坐标(i, j), 右下角坐标(x, y)

//矩形1(i1, j1)(x1, y1), 矩形2(i2, j2)(x2, y2)

i =  max(i1, i2);
j =  max(j1, j2);
x =  min(x1, x2);
y =  min(y1, y2);
``````

``````//相交矩形的坐标
i =  max(i1, i2, i3, ... , in);
j =  max(j1, j2, j3, ... , jn);
x =  min(x1, x2, x3, ... , xn);
y =  min(y1, y2, y3, ... , yn);
``````

AC代码如下：

``````#include<bits/stdc++.h>
using namespace std;

#define N 150000
int a[N][4];
multiset<int> s[4];

int main()
{
int n;
scanf("%d",&n);

for(int i=0;i<n;i++)//读入矩形
{
for(int j=0;j<4;j++)
{
scanf("%d",&a[i][j]);
s[j].insert(a[i][j]);
}
}

for(int i=0;i<n;i++)//枚举删除的矩形
{
for(int j=0;j<4;j++)//删除矩形
{
//不用s[j].erase(a[i][j])
//会删除所有的a[i][j]
s[j].erase(s[j].find(a[i][j]));
}

//满足i<=x&&j<=y,则n-1个矩形至少交于一点
if(*s[0].rbegin()<=*s[2].begin()&&*s[1].rbegin()<=*s[3].begin())
{
cout<<*s[0].rbegin()<<' '<<*s[1].rbegin()<<endl;
break;
}

//如果删除这个矩形不满足
//则恢复这个矩形，枚举下一个删除的矩形
for(int j=0;j<4;j++)
{
s[j].insert(a[i][j]);
}

}

return 0;
}
``````