fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
  6. if (x1 == x2 && y1 == y2) cout << "YES";
  7. else if ((abs(x1-x2) == 1 && abs(y1-y2) == 2) || (abs(x1-x2) == 2 && abs(y1-y2) == 1)) {
  8. cout << "YES";
  9. }else cout << "NO";
  10. }
Success #stdin #stdout 0.01s 5316KB
stdin
Standard input is empty
stdout
NO