Codeforces Round #461 (Div. 2) A. Cloning Toys (water problem)

Source: Internet
Author: User
Tags time limit


A. Cloning Toys
Time limit per test
1 second
Memory limit per test
Megabytes
Input
Standard input
Output
Standard output



IMP likes he plush toy a lot.



Recently, he found a machine that can clone plush toys. Imp knows that if he applies the machine to a original toy, he additionally gets one more original toy and one copy, and If he applies the machine to a copied toy, he gets both additional copies.



Initially, IMP has only one original toy. He wants to know if it's possible to use machine to get exactly x copied toys and y original toys? He can ' t throw toys away, and he can ' t apply the machine to a copy if he doesn ' t currently has any copies.
Input



The only line contains integers x and y (0≤x, y≤109)-the number of copies and the number of original Toys IMP WA NTS to get (including the initial one).
Output



Print "Yes", if the desired configuration is possible, and "No" otherwise.



You can print the arbitrary case (upper or lower).
Examples
Input



6 3



Output



Yes



Input



4 2



Output



No



Input



1000 1001



Output



Yes



Note



In the first example, IMP had to apply the machine twice to original toys and then twice to copies.



Although this problem is not difficult, there are many details to consider, the code will reflect


#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define inf 0x3f3f3f3f
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,a,b) for(int i=a;i>=b;i--)
#define rson rt<<1|1,m+1,r
#define lson rt<<1,l,m
using namespace std;
const int N=1e5;
int arr[N];
int main()
{
    ios::sync_with_stdio(false);
    int x,y;
    cin>>y>>x;
    if(x==1&&y>0||x==0)
    {
        cout<<"No"<<endl;
        return 0;
    }
    int c=x-1;
    y-=c;
    if(y>=0&&y%2==0)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.