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 and Y1 == Y2 || X1 - X2 == 1 and (abs(Y1 - Y2 == 1)) || X1 == X2 and (abs(Y1 - Y2 == 1)) || X1 + 1 == 2 and Y1 + 1 == 2 || X1 + 1 == X2 and Y1 == Y2 || (abs(X1 - X2 == 1)) and (abs(Y1 - Y2 == 1))){
  9. cout << "YES";
  10. }else{
  11. cout << "NO";
  12. }
  13. return 0;
  14. }
Success #stdin #stdout 0.01s 5280KB
stdin
3 3 
5 3
stdout
NO