Kyriakos Grizzly wants to create a new workout routine over the course of the next 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
. Furthermore, the sum of the weights over the
days must be divisible by
for maximal gains. Can you create a good workout routine for Kyriakos, or let him know that it's impossible?
Constraints
Subtask 1 [20%]
Subtask 2 [80%]
No additional constraints.
Input Specification
The only line of input contains 2 integers and
.
Output Specification
If no good workout routine exists output .
Otherwise, output one line containing integers. The integers must all be distinct and must all be in the range
, and their sum must be divisible by
.
Sample Input
6 9
Sample Output
2 5 7 3 10 9
Comments
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!
From the contest page:
Most of your submissions don't print any newline characters.
I looked at the previous comment because I was having the same problem, but even now, I still can't manage to avoid the presentation errors. Can someone please try to help me out? Thanks!
EDIT: I figured out how to avoid the presentation error
Could you explain how you avoided it? Thanks!
Your 20/100 submission has the right idea regarding presentation, as you are printing
, but if
(which can happen in subtask 2), your program will output
. As for your other submissions, as BalintR pointed out, you are not printing
"\n"
at the end of the line. That one gets WA on subtask 2 due to how all the numbers you output must be in the range"\n"
at the end of your line. You should also check that the values are separated by one space, and also that there are no trailing spaces.If you still need help, you should ask in the DMOJ Discord.