ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1145. Rope in the Labyrinth

AXIS Help me! [13] // Problem 1145. Rope in the Labyrinth 5 Feb 2007 23:44
I always got Stack Overflow on test 6, help!

[code deleted]

Edited by moderator 13.02.2007 20:52
dimozzz Re: Help me! [12] // Problem 1145. Rope in the Labyrinth 6 Feb 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.
Nechaev Ilya (Rybinsk SAAT) Re: Help me! [11] // Problem 1145. Rope in the Labyrinth 6 Feb 2007 00:35
Don't use DFS  :-)
AXIS Re: Help me! [10] // Problem 1145. Rope in the Labyrinth 6 Feb 2007 23:12
Thanks)

Stack size don't work, i tried.

P.S. How to BFS?)
KIRILL(ArcSTU) Re: Help me! [9] // Problem 1145. Rope in the Labyrinth 6 Feb 2007 23:31
AXIS wrote 6 February 2007 23:12
Thanks)

Stack size don't work, i tried.

)

Whats the problem??

{$M 16000000}  //From FAQ
AXIS Re: Help me! [7] // Problem 1145. Rope in the Labyrinth 6 Feb 2007 23:47
It's a kind of magic)

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

Now, it's WA6=)
AXIS Re: Help me! // Problem 1145. Rope in the Labyrinth 7 Feb 2007 00:08
This problem gonna take my brain...

Why WA???
KIRILL(ArcSTU) Re: Help me! [5] // Problem 1145. Rope in the Labyrinth 7 Feb 2007 00:15
AXIS wrote 6 February 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

AXIS Re: Help me! [4] // Problem 1145. Rope in the Labyrinth 7 Feb 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)
Nechaev Ilya (Rybinsk SAAT) Re: Help me! [3] // Problem 1145. Rope in the Labyrinth 7 Feb 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.
AXIS Re: Help me! [2] // Problem 1145. Rope in the Labyrinth 7 Feb 2007 20:10
AC finally..

But i don't understand, why dfs solve doesn't work
KIRILL(ArcSTU) Re: Help me! [1] // Problem 1145. Rope in the Labyrinth 7 Feb 2007 22:17
AXIS wrote 7 February 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
AlexF [USTU] Re: Help me! // Problem 1145. Rope in the Labyrinth 8 Feb 2007 00:00
Just 2 waves. I had WA#6, when I used short int instead of int for my lenght variable.
[RSU_Tash]Shavkat_Khusanov Re: Help me! // Problem 1145. Rope in the Labyrinth 1 Jan 2011 16:11
Thanks
{$M 16000000}
helped me.
finaly AC with 0.046s, but 10Mb memory.
I used simple recursion.