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

Турниры > CEN112 Questions 2016 > задача:


15-PE2-3. 50982 - A thief in labyrinth

CEN112 Questions 2016

Старт: 30.мар.2016 в 15:10:22
Финиш: 01.апр.2016 в 05:00:00
Турнир завершён!
• Турнирная таблица

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

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

• 15-PE-4. 50868 - Sort Frequencies
• 15-PE-5. 50869 - Birthday Celebration
• 15-PE-7. 50871 - Harmonic Mean
• 15-PE-8. 50872 - Top M Grades
• 15-PE2-1. 50980 - The smallest rect...
• 15-PE2-2. 50981 - Top popular m-st...
• 15-PE2-2. 50984 - Top m hardworki...
• 15-PE2-2. 51086 - Top popular student
• 15-PE2-3. 50982 - A thief in lab...
• 15-PE2-4. 50983 - Course Selection
• 15-PE2-6. 50985 - Books Waiting
• 15-PE2-8. 50987 - Very Looong Queue
• 15-RE-2. 50999 - Overlapping Trips
• 3. 51002 - The most successful classes
• 4. 51003 - Double Prime
• HW092. 51081 - Fish Pond I
• HW092. 51062 - Fish Pond II

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

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

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

A thief in labyrinth

Question: The police is running after a thief who is trying to run out of the building. Because, he wants to go out of high building, he goes only down, left, or right to the rooms which he did not visit before. And, he chooses always the room with the smaller value among the three adjacent rooms. Clever detective Jones knows this strategy and waiting outside of the building on his escape point at the ground floor. Write a program that finds the exit point of the thief.

Input specification: You will be given two integers in the beginning: the size of building (n) and starting room of the thief (x). In the following n lines, you will be given n integers which are between -10,000 and 10,000 where 1 ≤ x ≤ n ≤ 100

Output specification: Show the room number that the thief leaves the building on the ground floor. Note:If the three adjacent rooms have the same min values, follow the order: down, left and right.

Sample Input
6 6
10 18 4 14 0 8
4 20 18 4 17 2
7 16 19 13 20 10
11 7 0 7 11 10
11 2 8 13 8 20
5 6 6 11 20 5
Sample Output
2



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

www.contester.ru