A. Cloning Toys

Codeforces
IDCF922A
Time1000ms
Memory256MB
Difficulty
implementation
English · Original
Chinese · Translation
Formal · Original
Imp likes his plush toy a lot. <center>![image](https://espresso.codeforces.com/a5df87d0239cb116c7d665f512106966ac6928fc.png)</center>Recently, he found a machine that can clone plush toys. Imp knows that if he applies the machine to an original toy, he additionally gets one more original toy and one copy, and if he applies the machine to a copied toy, he gets two additional copies. Initially, Imp has only one original toy. He wants to know if it is 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 have any copies. ## Input The only line contains two integers _x_ and _y_ (0 ≤ _x_, _y_ ≤ 109) — the number of copies and the number of original toys Imp wants to get (including the initial one). ## Output Print "_Yes_", if the desired configuration is possible, and "_No_" otherwise. You can print each letter in arbitrary case (upper or lower). [samples] ## Note In the first example, Imp has to apply the machine twice to original toys and then twice to copies.
Imp 非常喜欢他的毛绒玩具。 最近,他发现了一台可以克隆毛绒玩具的机器。Imp 知道,如果他对一个原始玩具使用这台机器,他会额外得到一个原始玩具和一个副本;如果他对一个副本使用这台机器,他会额外得到两个副本。 最初,Imp 只有一个原始玩具。他想知道是否可以通过使用这台机器,恰好得到 #cf_span[x] 个 *副本* 和 #cf_span[y] 个 *原始* 玩具?他不能丢弃玩具,也不能在没有副本的情况下对副本使用机器。 输入仅包含两个整数 #cf_span[x] 和 #cf_span[y](#cf_span[0 ≤ x, y ≤ 109])— 分别表示 Imp 希望得到的副本数量和原始玩具数量(包括初始的那个)。 如果目标配置可行,输出 "_Yes_";否则输出 "_No_"。 你可以任意大小写输出每个字母。 在第一个例子中,Imp 需要对原始玩具使用两次机器,然后对副本使用两次机器。 ## Input 输入仅包含两个整数 #cf_span[x] 和 #cf_span[y](#cf_span[0 ≤ x, y ≤ 109])— 分别表示 Imp 希望得到的副本数量和原始玩具数量(包括初始的那个)。 ## Output 如果目标配置可行,输出 "_Yes_";否则输出 "_No_"。你可以任意大小写输出每个字母。 [samples] ## Note 在第一个例子中,Imp 需要对原始玩具使用两次机器,然后对副本使用两次机器。
**Definitions** Let $ x \in \mathbb{Z}_{\geq 0} $ be the target number of *copy* toys. Let $ y \in \mathbb{Z}_{\geq 1} $ be the target number of *original* toys (including the initial one). **Operations** - Applying the machine to an *original* toy: $ (o, c) \to (o+1, c+1) $ - Applying the machine to a *copy* toy: $ (o, c) \to (o, c+2) $ **Initial State** $ (o, c) = (1, 0) $ **Constraints** 1. $ o \geq 1 $, $ c \geq 0 $ at all times. 2. Machine cannot be applied to a copy if $ c = 0 $. **Objective** Determine whether there exists a sequence of operations transforming $ (1, 0) $ into $ (y, x) $. **Formal Condition** The configuration $ (x, y) $ is achievable if and only if: $$ y \geq 1 \quad \text{and} \quad x \geq y - 1 \quad \text{and} \quad (x - (y - 1)) \text{ is even} $$
Samples
Input #1
6 3
Output #1
Yes
Input #2
4 2
Output #2
No
Input #3
1000 1001
Output #3
Yes
API Response (JSON)
{
  "problem": {
    "name": "A. Cloning Toys",
    "description": {
      "content": "Imp likes his plush toy a lot. <center>![image](https://espresso.codeforces.com/a5df87d0239cb116c7d665f512106966ac6928fc.png)</center>Recently, he found a machine that can clone plush toys. Imp knows",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF922A"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Imp likes his plush toy a lot.\n\n<center>![image](https://espresso.codeforces.com/a5df87d0239cb116c7d665f512106966ac6928fc.png)</center>Recently, he found a machine that can clone plush toys. Imp knows...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "Imp 非常喜欢他的毛绒玩具。\n\n最近,他发现了一台可以克隆毛绒玩具的机器。Imp 知道,如果他对一个原始玩具使用这台机器,他会额外得到一个原始玩具和一个副本;如果他对一个副本使用这台机器,他会额外得到两个副本。\n\n最初,Imp 只有一个原始玩具。他想知道是否可以通过使用这台机器,恰好得到 #cf_span[x] 个 *副本* 和 #cf_span[y] 个 *原始* 玩具?他不能丢弃玩具,也不能...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ x \\in \\mathbb{Z}_{\\geq 0} $ be the target number of *copy* toys.  \nLet $ y \\in \\mathbb{Z}_{\\geq 1} $ be the target number of *original* toys (including the initial one).  \n\n**O...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments