Advertisement
sazid_iiuc

Untitled

May 27th, 2020
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.38 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. main()
  5. {
  6.     int l1, r1, l2, r2;
  7.     cin>>l1>>r1>>l2>>r2;
  8.  
  9.     if(l2 > r1)
  10.     {
  11.         cout<<"-1";
  12.     }
  13.     else if(l2 <= r1 && r2 <= r1)
  14.     {
  15.         cout<<l2<<" "<<r2;
  16.     }
  17.     else if(l2 == r1)
  18.     {
  19.         cout<<r1<<" "<<l2;
  20.     }
  21.     else if(l2 < r1 && r1 < r2)
  22.     {
  23.         cout<<l2<<" "<<r1;
  24.     }
  25.    
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement