P11007 『STA - R7』Odtlcsu

Background

![](https://cdn.luogu.com.cn/upload/image_hosting/m38cxgmq.png)

Description

Given integers $x,y$, construct an integer sequence of length at most $10^6$ such that its sum is $x$ and its sum of squares is $y$. It is guaranteed that a solution exists.

Input Format

One line with two integers $x,y$.

Output Format

The first line contains a non-negative integer $n$, indicating the length of the sequence you construct. It must satisfy $n\le 10^6$. The second line contains $n$ integers, representing the sequence you constructed. If there are multiple solutions, output any one. All elements in the output sequence must be integers with absolute value at most $10^6$.

Explanation/Hint

**This problem uses bundled tests.** Constraints: - Subtask 1 (10pts): $y\le 10$. - Subtask 2 (40pts): $x=0$. - Subtask 3 (50pts): No special constraints. For all testdata, $0\le |x|,y\le10^6$, and a solution is guaranteed to exist. Translated by ChatGPT 5