D. Jumps

Codeforces
IDCF10134D
Time2000ms
Memory256MB
Difficulty
English · Original
Formal · Original
A frog lives in a one-dimensional world in the point with the coordinate 0. He needs to get to the point with the coordinate x. For some reason he cannot make jumps of arbitrary length, and can jump only by a1, ..., an in any direction. Is he able to reach x? The first line contains two integers n and x separated by a space (1 ≤ n ≤ 200000,  - 109 ≤ x ≤ 109) — the number of variants of jump length and the coordinate of the point to reach. The second line contains n integers ai separated by spaces (1 ≤ ai ≤ 109) — the lengths of jumps the frog can make. Output «_YES_» (without quotes), if the frog can reach the point x, otherwise output «_NO_» (without quotes). ## Input The first line contains two integers n and x separated by a space (1 ≤ n ≤ 200000,  - 109 ≤ x ≤ 109) — the number of variants of jump length and the coordinate of the point to reach.The second line contains n integers ai separated by spaces (1 ≤ ai ≤ 109) — the lengths of jumps the frog can make. ## Output Output «_YES_» (without quotes), if the frog can reach the point x, otherwise output «_NO_» (without quotes). [samples]
**Definitions** Let $ n \in \mathbb{Z} $ be the number of passwords. For each $ i \in \{1, \dots, n\} $, let $ P_i $ be a string of length $ \ell_i $, where $ 9 \leq \ell_i \leq 100 $, consisting of characters from the union of: - Uppercase letters $ \mathcal{U} = \{A, B, \dots, Z\} $, - Lowercase letters $ \mathcal{L} = \{a, b, \dots, z\} $, - Digits $ \mathcal{D} = \{0, 1, \dots, 9\} $, - Symbols $ \mathcal{S} = \text{all other printable ASCII characters excluding letters and digits} $. Let $ c_i = P_i[\ell_i - 1] $ denote the last character of password $ P_i $. **Constraints** 1. $ 1 \leq n \leq 100 $ 2. For each $ i $, $ 9 \leq |P_i| \leq 100 $ **Objective** Determine the universal constraint on the last character across all passwords: - If $ \forall i, c_i \in \mathcal{L} \cup \mathcal{U} $, output "The last character must be a letter." - If $ \forall i, c_i \in \mathcal{D} $, output "The last character must be a digit." - If $ \forall i, c_i \in \mathcal{S} $, output "The last character must be a symbol." - Otherwise, output "The last character can be any type."
API Response (JSON)
{
  "problem": {
    "name": "D. Jumps",
    "description": {
      "content": "A frog lives in a one-dimensional world in the point with the coordinate 0. He needs to get to the point with the coordinate x. For some reason he cannot make jumps of arbitrary length, and can jump o",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10134D"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "A frog lives in a one-dimensional world in the point with the coordinate 0. He needs to get to the point with the coordinate x. For some reason he cannot make jumps of arbitrary length, and can jump o...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z} $ be the number of passwords.  \nFor each $ i \\in \\{1, \\dots, n\\} $, let $ P_i $ be a string of length $ \\ell_i $, where $ 9 \\leq \\ell_i \\leq 100 $, consisting ...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments