Advertisement
Manh_LK

Queen

Mar 22nd, 2020
1,073
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     freopen("input.txt", "r", stdin);
  8.     int r, c, n;
  9.     cin >> r >> c >> n;
  10.     for (int tc = 0; tc < n; tc++)
  11.     {
  12.         int rNew, cNew;
  13.         cin >> rNew >> cNew;
  14.         if (r == rNew || c == cNew || ((r + c) == (rNew + cNew)) || (abs(r - c) == abs(rNew - cNew))) cout << "yes" << endl;
  15.         else cout << "no" << endl;
  16.     }
  17.     return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement