CF1305E.Kuroni and the Score Distribution

提高+/省选-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

Kuroni is the coordinator of the next Mathforces round written by the "Proof by AC" team. All the preparation has been done, and he is discussing with the team about the score distribution for the round.

The round consists of nn problems, numbered from 11 to nn. The problems are ordered in increasing order of difficulty, no two problems have the same difficulty. A score distribution for the round can be denoted by an array a1,a2,…,ana_1, a_2, \dots, a_n, where aia_i is the score of ii-th problem.

Kuroni thinks that the score distribution should satisfy the following requirements:

  • The score of each problem should be a positive integer not exceeding 10910^9.
  • A harder problem should grant a strictly higher score than an easier problem. In other words, 1≤a1<a2<⋯<an≤1091 \leq a_1 \lt a_2 \lt \dots \lt a_n \leq 10^9.
  • The balance of the score distribution, defined as the number of triples (i,j,k)(i, j, k) such that 1≤i<j<k≤n1 \leq i \lt j \lt k \leq n and ai+aj=aka_i + a_j = a_k, should be exactly mm.

Help the team find a score distribution that satisfies Kuroni's requirement. In case such a score distribution does not exist, output −1-1.

Kuroni 是由 “Proof by AC” 团队编写的下一届 Mathforces 比赛的负责人。所有准备工作均已就绪,他正与团队讨论本次比赛的分值分布方案。

本场竞赛共包含 nn 道题目,编号为 11 到 nn。题目按难度递增顺序排列,任意两道题的难度均不相同。一轮比赛的分值分布可用一个数组 a1,a2,…,ana_1, a_2, \dots, a_n 表示,其中 aia_i 表示第 ii 道题的分值。

Kuroni 认为分值分布应满足以下要求:

  • 每道题的分值必须是不超过 10910^9 的正整数;
  • 更难的题目分值必须严格高于更简单的题目,即满足 1≤a1<a2<⋯<an≤1091 \leq a_1 \lt a_2 \lt \dots \lt a_n \leq 10^9;
  • 分值分布的平衡度(balance)定义为满足 1≤i<j<k≤n1 \leq i \lt j \lt k \leq n 且 ai+aj=aka_i + a_j = a_k 的三元组 (i,j,k)(i, j, k) 的个数,该平衡度必须恰好等于 mm。

请帮助该团队找出一个满足 Kuroni 要求的分值分布。若不存在这样的分值分布,则输出 −1-1。

输入格式

The first and single line contains two integers nn and mm (1≤n≤50001 \le n \le 5000, 0≤m≤1090 \leq m \leq 10^9) — the number of problems and the required balance.

第一行且唯一一行包含两个整数 nn 和 mm(1≤n≤50001 \le n \le 5000,0≤m≤1090 \leq m \leq 10^9)—— 分别表示题目数量和所需的平衡值。

输出格式

If there is no solution, print a single integer −1-1.

Otherwise, print a line containing nn integers a1,a2,…,ana_1, a_2, \dots, a_n, representing a score distribution that satisfies all the requirements. If there are multiple answers, print any of them.

如果无解,输出一个整数 −1-1。

否则,输出一行包含 nn 个整数 a1,a2,…,ana_1, a_2, \dots, a_n 的序列,表示一个满足所有要求的得分分布。如果有多个答案,输出任意一个即可。

输入输出样例

  • 输入#1

    5 3

    输出#1

    4 5 9 13 18
  • 输入#2

    8 0

    输出#2

    10 11 12 13 14 15 16 17
  • 输入#3

    4 10

    输出#3

    -1

说明/提示

In the first example, there are 33 triples (i,j,k)(i, j, k) that contribute to the balance of the score distribution.

  • (1,2,3)(1, 2, 3)
  • (1,3,4)(1, 3, 4)
  • (2,4,5)(2, 4, 5)

在第一个例子中,有 33 个三元组 (i,j,k)(i, j, k) 对分数分布的平衡性有贡献。

  • (1,2,3)(1, 2, 3)
  • (1,3,4)(1, 3, 4)
  • (2,4,5)(2, 4, 5)

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

首页