fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6. int X1, Y1, X2,Y2;
  7. cin >> X1 >> Y1 >> X2 >> Y2;
  8. if((X1-X2==1 or Y1-Y2==1 or (abs(X1-X2))== 1 or (abs(Y1-Y2)== 1))){
  9. cout << "YES";
  10. }else if(X1 > 4 or X2 > 4 or Y1 > 4 or Y2 > 4){
  11. cout << "NO";
  12. }
  13. return 0;
  14. }
Success #stdin #stdout 0.01s 5284KB
stdin
3 3 
5 4
stdout
YES