ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Турниры > CEN303 2013-15 Questions > задача:


15HW-60. 50678 - The Jumping Rabbit

CEN303 2013-15 Questions

Старт: 15.дек.2013 в 14:00:00
Финиш: 15.дек.2013 в 19:00:00
Турнир завершён!
• Турнирная таблица

Гость
• Вопросы к жюри (1)

Задачи турнира

• 15FE-01. 50851 - Repeated Numbers
• 15FE-01. 50838 - Balanced Numbers
• 15FE-04. 50997 - Dynamic Knights
• 15HW-10. 50826 - Olive Containers
• 15HW-30. 50828 - Arranging Time ...
• 15HW-40. 50676 - Cinema Millennium
• 15HW-40. 50829 - Decode an Image
• 15HW-50. 50830 - Sorting BST Nodes
• 15HW-60. 50678 - The Jumping ...
• 15MdE-10. 50802 - Comparing Exams
• 15MdE-20. 50803 - Sum of the dept...
• 15MdE-40. 50805 - Sum of the weig...
• 15PrE-10. 50816 - Largest Sum Path
• 15PrE-20. 50817 - The Knight Move
• 15PrE-30. 50818 - Depth Limited BST
• 15PrE-40. 50819 - Linked Numbers
• 15PrE2-01. 50847 - The first m train...

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
First asked in IMPC14 Ind_02 Question by Faruk Bulut.

The Jumping Rabbit

The wise rabbit wants to cross the way by jumping. The length of the way is L. The rabbit starts to jump from the start point 0, and reaches exactly on the point L. It goes always forward in the same direction. Its initial velocity (speed) is 0. In each jumping, the rabbit might increase its velocity 1 unit, or might decrease 1 unit, or might remain the same.

Question: The velocity of the rabbit is equal to the distance it crosses. The final velocity is negligible when it reaches to the L point.

While jumping, the rabbit wants to overrun the T traps placed on the way. There is no trap on the first (1) and last (L) point. Your mission is to execute the minimum number of jumps in order to reach to finish.

Example: L = 18
T (Trap points) = 5, 10, 15

In this example, as it is seen from the figure, the total number of jumps is 6.

Input specification
In the first line, there are two integers L and T numbers. The following T numbers, are the trap locations where 1 < T < 250 and 1 < L < 500.

Output specification
The output should be the minimum number of jumps performed by the rabbit in order to reach the final. If it cannot reach to the final, print -1.

Sample Input
18 3
5 10 15
Sample Output
6



Для отправки решений необходимо выполнить вход.

www.contester.ru