ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1145. Нить в лабиринте

Help me!
Послано AXIS 5 фев 2007 23:44
I always got Stack Overflow on test 6, help!

[code deleted]

Edited by moderator 13.02.2007 20:52
Re: Help me!
Послано dimozzz 6 фев 2007 00:28
I don't remeber...
Add this text in your program, before {APPTYPE CONSOLE}

{$MAXSTACKSIZE $10000000}

This number it is your stack size.
Re: Help me!
Послано Nechaev Ilya (Rybinsk SAAT) 6 фев 2007 00:35
Don't use DFS  :-)
Re: Help me!
Послано AXIS 6 фев 2007 23:12
Thanks)

Stack size don't work, i tried.

P.S. How to BFS?)
Re: Help me!
Послано KIRILL(ArcSTU) 6 фев 2007 23:31
AXIS писал(a) 6 февраля 2007 23:12
Thanks)

Stack size don't work, i tried.

)

Whats the problem??

{$M 16000000}  //From FAQ
Re: Help me!
Послано AXIS 6 фев 2007 23:47
It's a kind of magic)

i've forgotten Pascal completely...
MaxStackSize - this is Delphi code...

Now, it's WA6=)
Re: Help me!
Послано AXIS 7 фев 2007 00:08
This problem gonna take my brain...

Why WA???
Re: Help me!
Послано KIRILL(ArcSTU) 7 фев 2007 00:15
AXIS писал(a) 6 февраля 2007 23:47
It's a kind of magic)

i've forgotten Pascal completely...
MaxStackSize - this is Delphi code...

Now, it's WA6=)

The $MINSTACKSIZE and $MAXSTACKSIZE directives are used in Windows programming only.

As I know 2 DFS is needed for this problem

Re: Help me!
Послано AXIS 7 фев 2007 00:35
I've written two BFS - WA6.

My idea in this code - finding in the vertex V
the furthest vertexes, that they are in different subtrees
in tree with root V.

Something like that, hard to explain)
Re: Help me!
Послано Nechaev Ilya (Rybinsk SAAT) 7 фев 2007 16:52
First BFS - finding the free cell A that is the furthest from some free cell.
Second BFS - finding the free cell B that is the furthest from cell A.
Re: Help me!
Послано AXIS 7 фев 2007 20:10
AC finally..

But i don't understand, why dfs solve doesn't work
Re: Help me!
Послано KIRILL(ArcSTU) 7 фев 2007 22:17
AXIS писал(a) 7 февраля 2007 20:10
AC finally..

But i don't understand, why dfs solve doesn't work

I've solved it with dfs
It's very simple and fast
If you want I can send my solution to you
Re: Help me!
Послано AlexF [USTU] 8 фев 2007 00:00
Just 2 waves. I had WA#6, when I used short int instead of int for my lenght variable.
Re: Help me!
Послано [RSU_Tash]Shavkat_Khusanov 1 янв 2011 16:11
Thanks
{$M 16000000}
helped me.
finaly AC with 0.046s, but 10Mb memory.
I used simple recursion.