Page 1 of 1

Deluge

Posted: Mon Dec 08, 2008 10:17 pm
by therethinker
I think I've solved it: I've tested it on a few grids and they all work fine. It uses a proven method that has no reason *not* to work here.
I can't figure out why it's not flooding correctly.

Do I have to print the answer too, or do I leave it in memory?

Posted: Mon Dec 08, 2008 11:29 pm
by adum
just leave it in memory.

Posted: Tue Dec 09, 2008 9:39 am
by Karian
I'm also having a problem with this one. I tested a few examples, including the example of the page, and some special cases, but I can't get my answer accepted. first I thought that it was a problem that for some reason the spaces were stripped, but even changing those to another value wouldn't help.

Posted: Tue Dec 09, 2008 9:08 pm
by m!nus
don't be too happy with your solution for deluge, the challenges that come after it are a "bit" more difficult.

i tried searching some more optimal algorithm but didn't find real code where i can see how it gets implemented :/

Posted: Sat Jul 18, 2009 9:58 am
by Chocoholic
Uhm... I'm a bit confused about what this challenge is asking. So far I've got a program that correctly floods a few simple images, including the one from the page, but it still says that it doesn't flood correctly.

I might add that I based my program on the assumption that the top left pixel will only ever be 0 or 1. If it is 0 then the program floods correctly (as far as I can tell) and if it is 1 there is nothing to flood.

This assumption is based on the following two sentences from the description: Off pixels (the white ones in the sample image above) are zeroes. When your program terminates, all flooded pixels should have a value of 1.

Can anyone tell me if this is in fact correct?

Posted: Sun Jul 19, 2009 11:37 am
by gfoot
I think your assumptions are correct. I seem to remember it just says you failed to flood correctly even if the actual problem was an error, e.g. exceeding the cycle count. So if your algorithm does work on test images, but not when submitted, it's likely that it's just taking too many cycles, and you need to optimise it.

Posted: Sat Nov 10, 2012 12:49 pm
by guga
Hmm, this thread is old but for me the stated problem is still relevant.
My Program works fine on some sample inputs, including the one shown on the challenge-page and an empty grid. I'm always below 50k cycles, but the Program is not accepted (not flooding correctly).
Is there a limitation to the stack or call stack size? They are growing "quite big" (still < 1000) during the run.
I noticed some of those who had trouble with this as well finally solved this. So at least they should have an idea of what could be wrong with my program.

Any Hints?

thx
guga

Posted: Mon Jun 17, 2019 10:26 am
by Hippo
guga wrote:Hmm, this thread is old but for me the stated problem is still relevant.
My Program works fine on some sample inputs, including the one shown on the challenge-page and an empty grid. I'm always below 50k cycles, but the Program is not accepted (not flooding correctly).
Is there a limitation to the stack or call stack size? They are growing "quite big" (still < 1000) during the run.
I noticed some of those who had trouble with this as well finally solved this. So at least they should have an idea of what could be wrong with my program.

Any Hints?

thx
guga
When tested on HVM, have you checked the result of the algorithm. Are there just ones and zeroes and are they where they should be? Write it on a square paper to check it....

Hmm, it would help to make local copy of hvm and make some changes to show resulting memory (and increasy cycle count if needed), or experiment with python implementation.