A problem out of Codeforces that I can't solve

Revision en1, by Summer_Sheep, 2022-05-14 04:33:49

Giving an positive integer $$$n$$$ and another positive integer $$$d$$$ . You need to create an array that its length is $$$2 \times n$$$ ,and it must meet these conditions:

1, All the numbers between $$$1$$$ to $$$n$$$ must exist $$$2$$$ times. 2, For the number $$$i$$$,if $$$i$$$ is odd ,then the two position of $$$i$$$'s difference value must be more than $$$d$$$. 3, For the number $$$i$$$,if $$$i$$$ is even ,then the two position of $$$i$$$'s difference value must not be more than $$$d$$$.

if it has no solution,print -1. Else,print the array you create as your answer. It uses Special Judge ,so you can answer any array meet these conditions.

$$$1 \leq n \leq 10^6$$$. $$$1 \leq d \leq 5 \times 10^5$$$.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Summer_Sheep 2022-05-14 04:34:29 8
en1 English Summer_Sheep 2022-05-14 04:33:49 717 Initial revision (published)