Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cmath>
- using namespace std;
- int main()
- {
- freopen("input.txt", "r", stdin);
- int r, c, n;
- cin >> r >> c >> n;
- for (int tc = 0; tc < n; tc++)
- {
- int rNew, cNew;
- cin >> rNew >> cNew;
- if (r == rNew || c == cNew || ((r + c) == (rNew + cNew)) || (abs(r - c) == abs(rNew - cNew))) cout << "yes" << endl;
- else cout << "no" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement