N. Baby !Ehab

Codeforces
IDCF10288N
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
Baby !Ehab found this problem really hard: given 3 numbers, check if *at least* 2 of them are equal. The first line contains an integer $T$, the number of testcases. The next $T$ lines, each contains 3 positive numbers. The numbers are between $1$ and $20$. For each testcase, print "YES" if *at least* 2 of the 3 numbers are equal, "NO" otherwise. ## Input The first line contains an integer $T$, the number of testcases.The next $T$ lines, each contains 3 positive numbers. The numbers are between $1$ and $20$. ## Output For each testcase, print "YES" if *at least* 2 of the 3 numbers are equal, "NO" otherwise. [samples]
**Definitions** Let $ n \in \mathbb{Z}^+ $ be the number of agricultural products. Let $ m \in \mathbb{Z}_{\geq 0} $ be the number of directed constraints. Let $ \mathbf{x} = (x_1, x_2, \dots, x_n) \in \mathbb{Z}^n_{>0} $ be the value vector of the products. Let $ G = (V, E) $ be a directed graph with $ V = \{1, 2, \dots, n\} $ and $ E \subseteq V \times V $, where each edge $ (u, v) \in E $ means: if product $ u $ is selected, then product $ v $ must also be selected. Let $ S \subseteq V $ be a subset of selected products. Define the **total value** of $ S $ as: $$ f(S) = \frac{\left( \sum_{i \in S} x_i \right)^2}{\sum_{i \in S} x_i^2} $$ **Constraints** 1. $ 1 \leq n \leq 40 $ 2. $ 0 \leq m \leq n^2 - n $ 3. $ 1 \leq x_i \leq 1000 $ for all $ i \in V $ 4. For each $ (u, v) \in E $, if $ u \in S $, then $ v \in S $. **Objective** Find the subset $ S \subseteq V $ satisfying all constraints in $ E $, that maximizes $ f(S) $. Output the maximum value of $ f(S) $.
API Response (JSON)
{
  "problem": {
    "name": "N. Baby !Ehab",
    "description": {
      "content": "Baby !Ehab found this problem really hard: given 3 numbers, check if *at least* 2 of them are equal. The first line contains an integer $T$, the number of testcases. The next $T$ lines, each contain",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10288N"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Baby !Ehab found this problem really hard: given 3 numbers, check if *at least* 2 of them are equal.\n\nThe first line contains an integer $T$, the number of testcases.\n\nThe next $T$ lines, each contain...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $ be the number of agricultural products.  \nLet $ m \\in \\mathbb{Z}_{\\geq 0} $ be the number of directed constraints.  \nLet $ \\mathbf{x} = (x_1, x_2, \\dots, x...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments