#P11007. 『STA - R7』Odtlcsu

『STA - R7』Odtlcsu

Background

Problem Description

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

Input Format

One line with two integers x,yx,y.

Output Format

The first line contains a non-negative integer nn, indicating the length of the sequence you construct. It must satisfy n106n\le 10^6.

The second line contains nn 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 10610^6.

100 5000
2
50 50
0 5000
2
50 -50

Hint

This problem uses bundled tests.

Constraints:

  • Subtask 1 (10pts): y10y\le 10.
  • Subtask 2 (40pts): x=0x=0.
  • Subtask 3 (50pts): No special constraints.

For all testdata, 0x,y1060\le |x|,y\le10^6, and a solution is guaranteed to exist.

Translated by ChatGPT 5