L. Coordinate Paper

Codeforces
IDCF10283L
Time1000ms
Memory256MB
Difficulty
English · Original
Formal · Original
Once there was a contest, where the last problem was about coordinate paper. You were given a piece of coordinate paper, where there were grids of $n$ rows and $10^(100)$ columns. The grids were initially white, and you might paint some of them black. In that problem, you were required to paint the paper in a special way. Suppose the number of black grids in the $i$-th row is $a_i$. Your painting was supposed to satisfy that Can you still find an answer to that problem? The only line contains three integers $n$, $k$ and $s$ ($1 <= n, k <= 10^5$, $1 <= s <= 10^(18)$). If there is no solution, print "-1" (without quotes). Otherwise, print the $n$ integers $a_1, \\dots, a_n$. Any answer satisfying all requirements will be accepted. In this problem, extra blank characters will be ignored when your answer is judged. ## Input The only line contains three integers $n$, $k$ and $s$ ($1 <= n, k <= 10^5$, $1 <= s <= 10^(18)$). ## Output If there is no solution, print "-1" (without quotes).Otherwise, print the $n$ integers $a_1, \\dots, a_n$. Any answer satisfying all requirements will be accepted.In this problem, extra blank characters will be ignored when your answer is judged. [samples]
**Definitions** Let $ n, k, s \in \mathbb{Z}^+ $ with $ 1 \leq n, k \leq 10^5 $ and $ 1 \leq s \leq 10^{18} $. Let $ A = (a_1, a_2, \dots, a_n) $ be a sequence of non-negative integers representing the number of black cells in each row. **Constraints** 1. $ \sum_{i=1}^n a_i = s $ 2. $ 0 \leq a_i \leq k $ for all $ i \in \{1, \dots, n\} $ 3. The sequence $ A $ must satisfy the condition that **no two adjacent rows both have exactly $ k $ black cells** (i.e., $ \forall i \in \{1, \dots, n-1\},\ \neg(a_i = k \land a_{i+1} = k) $). **Objective** Find any sequence $ A $ satisfying the above constraints, or output $-1$ if none exists.
API Response (JSON)
{
  "problem": {
    "name": "L. Coordinate Paper",
    "description": {
      "content": "Once there was a contest, where the last problem was about coordinate paper. You were given a piece of coordinate paper, where there were grids of $n$ rows and $10^(100)$ columns. The grids were initi",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF10283L"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Once there was a contest, where the last problem was about coordinate paper. You were given a piece of coordinate paper, where there were grids of $n$ rows and $10^(100)$ columns. The grids were initi...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n, k, s \\in \\mathbb{Z}^+ $ with $ 1 \\leq n, k \\leq 10^5 $ and $ 1 \\leq s \\leq 10^{18} $.  \nLet $ A = (a_1, a_2, \\dots, a_n) $ be a sequence of non-negative integers representin...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments