CF414A.Mashmokh and Numbers

普及/提高-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

It's holiday. Mashmokh and his boss, Bimokh, are playing a game invented by Mashmokh.

In this game Mashmokh writes sequence of n distinct integers on the board. Then Bimokh makes several (possibly zero) moves. On the first move he removes the first and the second integer from from the board, on the second move he removes the first and the second integer of the remaining sequence from the board, and so on. Bimokh stops when the board contains less than two numbers. When Bimokh removes numbers x and y from the board, he gets gcd(x, y) points. At the beginning of the game Bimokh has zero points.

Mashmokh wants to win in the game. For this reason he wants his boss to get exactly k points in total. But the guy doesn't know how choose the initial sequence in the right way.

Please, help him. Find n distinct integers _a_1, _a_2, ..., a__n such that his boss will score exactly k points. Also Mashmokh can't memorize too huge numbers. Therefore each of these integers must be at most 109.

现在是假期。玛什莫赫(Mashmokh)和他的老板比莫赫(Bimokh)正在玩一个由玛什莫赫发明的游戏。

游戏中,玛什莫赫在黑板上写下长度为 nn 的互不相同的整数序列。接着,比莫赫进行若干轮(可能为零轮)操作:第一轮,他从黑板上移除第一个和第二个整数;第二轮,他从剩余序列中移除第一个和第二个整数;依此类推。当黑板上剩余数字少于两个时,比莫赫停止操作。每当比莫赫从黑板上移除两个数 xx 和 yy 时,他获得 gcd⁡(x, y)\gcd(x,\,y) 分。游戏开始时,比莫赫的得分为 00。

玛什莫赫希望赢得这场游戏。因此,他希望他的老板恰好获得 kk 分。但他不知道该如何恰当地选择初始序列。

请帮助他!找出 nn 个互不相同的整数 a1, a2, ..., ana_1,\,a_2,\,...,\,a_n,使得他的老板最终恰好获得 kk 分。此外,玛什莫赫记不住过大的数字,因此这些整数中每一个都至多为 10910^9。

输入格式

The first line of input contains two space-separated integers n, k (1 ≤ n ≤ 105; 0 ≤ k ≤ 108).

输入的第一行包含两个以空格分隔的整数 nn 和 kk(1 ≤ n ≤ 1051 \leq n \leq 10^5;0 ≤ k ≤ 1080 \leq k \leq 10^8)。

输出格式

If such sequence doesn't exist output -1 otherwise output n distinct space-separated integers _a_1, _a_2, ..., a__n (1 ≤ a__i ≤ 109).

如果不存在这样的序列,则输出 -1;否则输出 n 个互不相同的、以空格分隔的整数 _a_₁, _a_₂, ..., a__n(1 ≤ a__i ≤ 10⁹)。

输入输出样例

  • 输入#1

    5 2

    输出#1

    1 2 3 4 5
  • 输入#2

    5 3

    输出#2

    2 4 3 7 1
  • 输入#3

    7 2

    输出#3

    -1

说明/提示

gcd(x, y) is greatest common divisor of x and y.

gcd⁡(x,y)\gcd(x, y) 是 xx 和 yy 的最大公约数。

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

首页