fork download
  1.  
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7. int L1, R1, R2, L2;
  8. cin >> L1 >> R1 >> L2 >> R2;
  9.  
  10. if (L2 <= R1 && R2 >= L1) {
  11. cout << max(L1, L2) << " " << min(R1, R2);
  12. }
  13. else { cout << -1; }
  14.  
  15. return 0;
  16. }
  17.  
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout
-1