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

Турниры > IMPC-2014-15 Questions > задача:


Ind_03-40. 50777 - Dwarfs Maze

IMPC-2014-15 Questions

Старт: 22.ноя.2014 в 15:00:00
Финиш: 22.ноя.2014 в 20:00:00
Турнир завершён!
• Турнирная таблица

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

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

• Ind_01-20. 50416 - Placing Domino...
• Ind_01-30. 50764 - Fast Typing Co...
• Ind_01-50. 50718 - Elevator
• Ind_02-10. 50497 - Falling Bricks - ...
• Ind_02-20. 50745 - Bitonic Sequence
• Ind_02-30. 50657 - Permutations an...
• Ind_03-10. 50743 - Total Scholarshi...
• Ind_03-20. 50515 - Lines - Revisited
• Ind_03-40. 50777 - Dwarfs Maze
• Ind_03-50. 50679 - Jetpack Hurdle J...
• Ind_04-10. 50787 - Expected Value
• Ind_04-20. 50520 - Filling a Matrix ...
• Ind_04-30. 50658 - The Message

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

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

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Kamila Hasanbega.

Dwarfs Maze

In Dwarfs land in order for someone to pass the test to go to the Dwarf-Academy (which is one of the most competitive ones in those regions), someone has to pass a special kind of maze. This maze is 3D and can have 1 ≤ N ≤ 30 floors. Each floor is made of blocks marked by '#' or empty spaces marked by '.' from which you can move, ascend or descend to other floors. Given the plane of each of the maze’s floors the Dwarfs bear the burden of finding the shortest path from the entering portal marked with “B”, to the leaving portal marked with 'F'. Now Tom is not such a witty dwarf, but he heard you are good at algorithms, so he is wondering if you can help him out.

Question: Given the plane of the floors of the maze find the shortest path from the entering to the leaving portal.

Input specification
In the first line will be 1 ≤ a ≤ 5, 1 ≤ b ≤30, 1 ≤ c≤ 30 where 'a' is the number of floors, while b and c are the lengths of width and height of each floor.

Output specification
If there is a way output the number of steps to reach the destination, otherwise output "Impossible".

Sample Input I
2 4 5
B....
.###.
.##..
###.#

#####
#####
##.##
##..F
Sample Input II
1 3 3
B##
###
##F
Sample Output II
10
Sample Output II
Impossible



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

www.contester.ru