Блог пользователя Summer_Sheep

Автор Summer_Sheep, история, 2 года назад, По-английски

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$$$.

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится