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

Разделы > Linear Data structures: Stacks, Queues, Linked Lists, etc > задача:


50777 - Dwarfs Maze

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

Задачи раздела

• 50262 - Brackets
• 50291 - Postfix Arithmetic Expressions
• 50286 - Remove Duplicates
• 50340 - Game 19
• 50877 - Friendly Queue
• 51086 - Top popular student
• 50777 - Dwarfs Maze
• 50781 - ReversesreveR
• 50780 - Hot Potato - Revisited
• 50564 - Kovat e qumeshtit te mamase
• 50636 - Скобки
• 50776 - Numri i rrugeve te ndryshm...
• 50779 - Rruga me e shkurter ne lab...
• 50775 - Balanced Parenthesis
• 50774 - Hot Potato

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

Если у вас есть предложения или пожелания по работе 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