A. Square Root Partitioning

Codeforces
IDCF10235A
Time3000ms
Memory256MB
Difficulty
English · Original
Formal · Original
Consider the following expression: $$\sqrt{a_1} \pm \sqrt{a_2} \pm \dots \pm \sqrt{a_n} = 0\text{.}$$ Calculate the number of ways to replace each $plus.minus$ with $+$ or $-$ so that it holds true. The first line of input contains a single integer $n$ ($2 <= n <= 36$). Second line of input contains $n$ integers $a_1, a_2, \\dots, a_n$ ($1 <= a_i <= 10^(10^5)$). Output a single integer: the answer to the problem. ## Input The first line of input contains a single integer $n$ ($2 <= n <= 36$).Second line of input contains $n$ integers $a_1, a_2, \\dots, a_n$ ($1 <= a_i <= 10^(10^5)$). ## Output Output a single integer: the answer to the problem. [samples]
**Definitions** Let $ n \in \mathbb{Z} $ with $ 2 \leq n \leq 36 $. Let $ A = (a_1, a_2, \dots, a_n) $ be a sequence of positive integers, where $ 1 \leq a_i \leq 10^{10^5} $ for all $ i $. **Constraints** None beyond those specified in definitions. **Objective** Count the number of sign vectors $ s = (s_1, s_2, \dots, s_n) \in \{+1, -1\}^n $ such that: $$ \sum_{i=1}^n s_i \sqrt{a_i} = 0 $$
API Response (JSON)
{
  "problem": {
    "name": "A. Square Root Partitioning",
    "description": {
      "content": "Consider the following expression: $$\\sqrt{a_1} \\pm \\sqrt{a_2} \\pm \\dots \\pm \\sqrt{a_n} = 0\\text{.}$$ Calculate the number of ways to replace each $plus.minus$ with $+$ or $-$ so that it holds true. ",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 3000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10235A"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Consider the following expression: $$\\sqrt{a_1} \\pm \\sqrt{a_2} \\pm \\dots \\pm \\sqrt{a_n} = 0\\text{.}$$ Calculate the number of ways to replace each $plus.minus$ with $+$ or $-$ so that it holds true.\n\n...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z} $ with $ 2 \\leq n \\leq 36 $.  \nLet $ A = (a_1, a_2, \\dots, a_n) $ be a sequence of positive integers, where $ 1 \\leq a_i \\leq 10^{10^5} $ for all $ i $.\n\n**Con...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments