An Animal Contest 6 P1 - Workout Routine

View as PDF

Submit solution


Points: 5 (partial)
Time limit: 2.0s
Memory limit: 256M

Authors:
Problem type

Kyriakos Grizzly wants to create a new workout routine over the course of the next N days. In order for a workout routine to be good, the amount of weights he lifts each day must be pairwise distinct, and must be in the range [1,10^9]. Furthermore, the sum of the weights over the N days must be divisible by K for maximal gains. Can you create a good workout routine for Kyriakos, or let him know that it's impossible?

Constraints

1 \le N, K \le 10^6

Subtask 1 [20%]

1 \le N \times K \le 10^9

Subtask 2 [80%]

No additional constraints.

Input Specification

The only line of input contains 2 integers N and K.

Output Specification

If no good workout routine exists output -1.

Otherwise, output one line containing N integers. The integers must all be distinct and must all be in the range [1,10^9], and their sum must be divisible by K.

Sample Input

6 9

Sample Output

2 5 7 3 10 9

Comments


  • 0
    Codester  commented on March 23, 2022, 1:59 a.m.

    Is there a simple reason why I might be getting presentation error? My code worked for the first subtask but not for the second subtask and I'm not sure if it's an error in formatting or the logic. Thanks!


    • 0
      BalintR  commented on March 23, 2022, 3:37 a.m.

      From the contest page:

      Checkers: unless otherwise specified, identical. The contest will follow the standard convention of having all lines terminate in a \n character, with no trailing whitespace.

      Most of your submissions don't print any newline characters.