CF111A.Petya and Inequiations

普及/提高-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Little Petya loves inequations. Help him find n positive integers _a_1, _a_2, ..., a__n, such that the following two conditions are satisfied:

  • _a_12 + _a_22 + ... + _a__n_2 ≥ x
  • _a_1 + _a_2 + ... + a__n ≤ y

小Petya喜欢不等式。请帮他找出 nn 个正整数 a1, a2, ..., ana_1,\,a_2,\,...,\,a_n,使得以下两个条件同时满足:

  • a12+a22+⋯+an2≥xa_1^2 + a_2^2 + \dots + a_n^2 \ge x
  • a1+a2+⋯+an≤ya_1 + a_2 + \dots + a_n \le y

输入格式

The first line contains three space-separated integers n, x and y (1 ≤ n ≤ 105, 1 ≤ x ≤ 1012, 1 ≤ y ≤ 106).

Please do not use the %lld specificator to read or write 64-bit integers in С++. It is recommended to use cin, cout streams or the %I64d specificator.

第一行包含三个以空格分隔的整数 nn、xx 和 yy(1 ≤ n ≤ 1051 ≤ n ≤ 10^5,1 ≤ x ≤ 10121 ≤ x ≤ 10^{12},1 ≤ y ≤ 1061 ≤ y ≤ 10^6)。

在 C++ 中,请勿使用 %lld 格式说明符读取或写入 64 位整数。建议使用 cin、cout 流或 %I64d 格式说明符。

输出格式

Print n positive integers that satisfy the conditions, one integer per line. If such numbers do not exist, print a single number "-1". If there are several solutions, print any of them.

输出 n 个满足条件的正整数,每个整数占一行。若不存在这样的数,则输出单个数字 “-1”。若存在多个解,输出其中任意一个即可。

输入输出样例

  • 输入#1

    5 15 15

    输出#1

    4
    4
    1
    1
    2
  • 输入#2

    2 3 2

    输出#2

    -1
  • 输入#3

    1 99 11

    输出#3

    11

输入解题思路,AI测评打分。不知道怎么写?

首页