Untitled
unknown
plain_text
a year ago
858 B
2
Indexable
Never
#include <stdio.h> int main() { long long int l1,r1,l2,r2; scanf("%lld %lld %lld %lld",&l1,&r1,&l2,&r2); ///taking the values if ((r1-l2)>=0) { if (r2>r1) { printf("%lld %lld",l2,r1); } else if(r2<r1) { printf("%lld %lld",l2,r2); } else if (r1==r2 && l1>l2) { printf("%lld %lld",l1,r1); } else if (r1==r2 && l1<l2 && r1==l2) { printf("%lld %lld",r1,l2); } else if (r1==r2 && l1<l2 && r1!=l2) { printf("%lld %lld",l2,r2); } else { printf("%lld %lld",l1,r1); } } else if((r1-l2)<0) { printf("-1"); } return 0; }