... HAVE U TRIED .... AT LEAST 3 TIMES ... OK U CAN SEE THIS ...

Saturday, January 4, 2014

UVA-460 :: Overlapping Rectangles

//Problem link >>http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=401


#include <bits/stdc++.h>
using namespace std ;
int main ()
{
    int t , i=0 , a1,a2,b1,b2,c1,c2,d1,d2 ;
    cin>>t ;
    while(i<t)
    {
        i++ ;
        if (i>1) cout<<endl ;
        cin>>a1>>a2>>b1>>b2 ;
        cin>>c1>>c2>>d1>>d2 ;
        int mx1= max(a1,c1) ;
        int mx2= max(a2,c2) ;
        int mn1=min(b1,d1) ;
        int mn2=min(b2,d2) ;

        if (mx1>=mn1 || mx2>=mn2) cout<<"No Overlap"<<endl ;
        else cout<<mx1<<" "<<mx2<<" "<<mn1<<" "<<mn2<<endl ;
    }

    return 0 ;
}

No comments:

Post a Comment