Diagonal Movement codechef solution
Given the coordinates of a point in 2-D plane. Find if it is possible to reach from . The only possible moves from any coordinate are as follows:
- Go to the point with coordinates .
- Go to the point with coordinates
- Go to the point with coordinates .
- Go to the point with coordinates .
Input Format
- First line will contain , number of testcases. Then the testcases follow.
- Each testcase contains of a single line of input, two integers .
Output Format
For each test case, print YES if it is possible to reach from , otherwise print NO.
You may print each character of the string in uppercase or lowercase (for example, the strings "yEs", "yes", "Yes" and "YES" will all be treated as identical).
Constraints
Sample Input 1
6
0 2
1 2
-1 -3
-1 0
-3 1
2 -1
Sample Output 1
YES
NO
YES
NO
YES
NO
Explanation
Test case : A valid sequence of moves can be: .
Test case : There is no possible way to reach the point from .
Test case : A valid sequence of moves can be:
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fr(i, a, b) for (ll i = a; i < b; i++)
ll const N = 1e6;
int main()
{
int t;
cin >> t;
while (t--)
{
ll x,y;
cin>>x>>y;
ll s=x+y;
if(s%2==0)
cout<<"YES\n";
else
cout<<"NO\n";
}
return 0;
}
Comments
Post a Comment