A13171 | Kuroni and the Score Distribution
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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 $n$ problems, numbered from $1$ to $n$ . 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 $a_1, a_2, \dots, a_n$ , where $a_i$ is the score of $i$ -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 $10^9$ .
- A harder problem should grant a strictly higher score than an easier problem. In other words, $1 \leq a_1 < a_2 < \dots < a_n \leq 10^9$ .
- The balance of the score distribution, defined as the number of triples $(i, j, k)$ such that $1 \leq i < j < k \leq n$ and $a_i + a_j = a_k$ , should be exactly $m$ .
Help the team find a score distribution that satisfies Kuroni's requirement. In case such a score distribution does not exist, output $-1$ .
The round consists of $n$ problems, numbered from $1$ to $n$ . 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 $a_1, a_2, \dots, a_n$ , where $a_i$ is the score of $i$ -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 $10^9$ .
- A harder problem should grant a strictly higher score than an easier problem. In other words, $1 \leq a_1 < a_2 < \dots < a_n \leq 10^9$ .
- The balance of the score distribution, defined as the number of triples $(i, j, k)$ such that $1 \leq i < j < k \leq n$ and $a_i + a_j = a_k$ , should be exactly $m$ .
Help the team find a score distribution that satisfies Kuroni's requirement. In case such a score distribution does not exist, output $-1$ .
输入格式
The first and single line contains two integers $n$ and $m$ ( $1 \le n \le 5000$ , $0 \leq m \leq 10^9$ ) — the number of problems and the required balance.
输出格式
If there is no solution, print a single integer $-1$ .
Otherwise, print a line containing $n$ integers $a_1, a_2, \dots, a_n$ , representing a score distribution that satisfies all the requirements. If there are multiple answers, print any of them.
Otherwise, print a line containing $n$ integers $a_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
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 $3$ triples $(i, j, k)$ that contribute to the balance of the score distribution.
- $(1, 2, 3)$
- $(1, 3, 4)$
- $(2, 4, 5)$
- $(1, 2, 3)$
- $(1, 3, 4)$
- $(2, 4, 5)$
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted