J. Weird Sanchola

Codeforces
IDCF10230J
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
Sanchola is getting an array of integers as gift. He's weird, so he doesn't like having distinct integers in the same array and he only likes prime numbers. That's why he believes that he might need to fix the array after receiving it by turning all elements into the same prime number. Sanchola is also very lazy and wants to do that using the minimum number of operations. In one operation Sanchola can either increase or decrease a single element of the array by one. Given the array that he received as a gift, help Sanchola figuring out the minimum number of operations required to fix the array. The first line contains a single integer $N$ $(1 <= N <= 10^5)$, indicating the length of the array. The second line contains $N$ integers $a_1$, $a_2$, ..., $a_n$ $(1 <= N <= 10^9)$, indicating the elements of the array $a$. In a single line output the minimum number of operations to satisfy Sanchola. ## Input The first line contains a single integer $N$ $(1 <= N <= 10^5)$, indicating the length of the array.The second line contains $N$ integers $a_1$, $a_2$, ..., $a_n$ $(1 <= N <= 10^9)$, indicating the elements of the array $a$. ## Output In a single line output the minimum number of operations to satisfy Sanchola. [samples]
**Definitions** Let $ n \in \mathbb{Z}^+ $, $ \mathbf{A} \in \mathbb{R}^{n \times n} $, $ \mathbf{b} = (b_1, \dots, b_n) \in \mathbb{Z}_{>0}^n $. Define the linear map $ \mathbf{y}(\mathbf{x}) = \mathbf{A} \mathbf{x} $ for $ \mathbf{x} \in \mathbb{R}^n $. **Constraints** The integral is over the region: $$ R = \left\{ \mathbf{x} \in \mathbb{R}^n \,\middle|\, 0 \leq (\mathbf{A} \mathbf{x})_k \leq b_k \text{ for all } k = 1, \dots, n \right\} $$ The objective is to compute: $$ I = \left( \int_{\mathbb{R}^n} \prod_{k=1}^n \mathbf{1}_{[0, b_k]}((\mathbf{A} \mathbf{x})_k) \, d\mathbf{x} \right)^2 $$ Assume $ I $ is finite and rational: $ I = \frac{u}{d} $, $ \gcd(u,d) = 1 $. **Objective** If $ I $ is infinite or $ d^{-1} \not\equiv \pmod{1000000007} $, output `"Orz"`. Otherwise, output $ u \cdot d^{-1} \mod 1000000007 $.
API Response (JSON)
{
  "problem": {
    "name": "J. Weird Sanchola",
    "description": {
      "content": "Sanchola is getting an array of integers as gift. He's weird, so he doesn't like having distinct integers in the same array and he only likes prime numbers. That's why he believes that he might need t",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10230J"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Sanchola is getting an array of integers as gift. He's weird, so he doesn't like having distinct integers in the same array and he only likes prime numbers. That's why he believes that he might need t...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z}^+ $, $ \\mathbf{A} \\in \\mathbb{R}^{n \\times n} $, $ \\mathbf{b} = (b_1, \\dots, b_n) \\in \\mathbb{Z}_{>0}^n $.  \nDefine the linear map $ \\mathbf{y}(\\mathbf{x}) = \\...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments