#include <fstream>
using namespace std;
ifstream fin("date.in");
ofstream fout("date.out");
struct interval
{
double a,b;
};
int n;
interval X[100];
int main()
{
int i,j;
interval aux;
float xr,yr;
fin>>n;
for(i=1;i<=n;i++) fin>>X[i].a>>X[i].b;
for(i=1;i<n;i++)
for(j=i+1;j<=n;j++)
if(X[i].b>X[j].b)
{
aux=X[i]; X[i]=X[j]; X[j]=aux;
}
xr=X[1].a; yr=X[1].b;
for(i=2;i<=n;i++)
if(X[i].a<yr)
{
if(X[i].a<xr) xr=X[i].a;
yr=X[i].b;
}
else
{
fout<<"("<<xr<<","<<yr<<") U ";
xr=X[i].a;
yr=X[i].b;
}
fout<<"("<<xr<<","<<yr<<") ";
fout.close();
fin.close();
return 0;
}
|