D. Wooden Fence

Codeforces
IDCF10197D
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
Asem has a wooden fence consisting of n boards, in which n is an odd number. Asem wants to paint this fence using two colors; black and white, such that the first board will be painted black, the second board will be painted white, the third board will be painted black, and so on. Asem has black paint that can paint at most x boards and white paint that can paint at most y boards. Your task is to determine if you can paint the whole fence or not. Can you? The first line contains an integer T (1 ≤ T ≤ 104) specifying the number of test cases. Each test case consists of a line containing three integers n, x, y (1 ≤ n, x, y < 109), in which n is an odd number specifying the number of boards in the fence, x is the maximum number of boards that can be painted in black, and y is the maximum number of boards that can be painted in white. For each test case, print a single line containing "_YES_" (without quotes) if you can paint the whole fence. Otherwise, print "_NO_" (without quotes). ## Input The first line contains an integer T (1 ≤ T ≤ 104) specifying the number of test cases.Each test case consists of a line containing three integers n, x, y (1 ≤ n, x, y < 109), in which n is an odd number specifying the number of boards in the fence, x is the maximum number of boards that can be painted in black, and y is the maximum number of boards that can be painted in white. ## Output For each test case, print a single line containing "_YES_" (without quotes) if you can paint the whole fence. Otherwise, print "_NO_" (without quotes). [samples]
**Definitions** Let $ T \in \mathbb{Z} $ be the number of test cases. For each test case $ k \in \{1, \dots, T\} $: - $ n_k \in \mathbb{Z} $ is an odd integer denoting the number of boards. - $ x_k \in \mathbb{Z} $ is the maximum number of boards that can be painted black. - $ y_k \in \mathbb{Z} $ is the maximum number of boards that can be painted white. **Constraints** 1. $ 1 \le T \le 10^4 $ 2. For each $ k \in \{1, \dots, T\} $: - $ 1 \le n_k < 10^9 $, and $ n_k $ is odd - $ 1 \le x_k < 10^9 $ - $ 1 \le y_k < 10^9 $ **Objective** For each test case $ k $, determine if: $$ \left\lceil \frac{n_k}{2} \right\rceil \le x_k \quad \text{and} \quad \left\lfloor \frac{n_k}{2} \right\rfloor \le y_k $$ If both conditions hold, output "YES"; otherwise, output "NO".
API Response (JSON)
{
  "problem": {
    "name": "D. Wooden Fence",
    "description": {
      "content": "Asem has a wooden fence consisting of n boards, in which n is an odd number. Asem wants to paint this fence using two colors; black and white, such that the first board will be painted black, the seco",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10197D"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Asem has a wooden fence consisting of n boards, in which n is an odd number. Asem wants to paint this fence using two colors; black and white, such that the first board will be painted black, the seco...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ T \\in \\mathbb{Z} $ be the number of test cases.  \nFor each test case $ k \\in \\{1, \\dots, T\\} $:  \n- $ n_k \\in \\mathbb{Z} $ is an odd integer denoting the number of boards.  \n- ...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments