Flash Flood Warmup

Discussion of challenges you have already solved
Post Reply
User avatar
Rat62
Posts: 17
Joined: Tue Nov 23, 2010 5:00 pm

Flash Flood Warmup

Post by Rat62 »

'Flash Flood Warmup' is rated '10' while 'Deluge' is 55. By intention?

My first tries were at about 27000 cycles (simple recursive approach). Then I noticed that it is always the same image, filled those 3 islands with 2's (enumerating 30 cells) and then marked all cells 0 if they are 2 or 1 otherwise. Took less than 10000 cycles. I'd call that cheating and probably not the way it was intended.
User avatar
Hippo
Posts: 339
Joined: Sat Feb 01, 2014 12:05 am
Location: Praha 5

Post by Hippo »

I have tried to change the algorithm from trivial DFS/BFS ... I have used variant of union find on 0 regions ... and if I remember well I did the warmup with it. But for the next level I was not able to lower the cycle count enough and I have returned to the almost trivial DFS with several enhancements ... let us see what will work second next level.
stubbscroll
Posts: 9
Joined: Sat Dec 11, 2010 11:25 pm
Location: NO

Post by stubbscroll »

I managed to solve this in 23054 cycles with a recursive flood-fill algorithm. I used one optimization: Split the recursive routine into 4, each of the 4 routines doesn't re-check the direction where we came from.
Simonselles
Posts: 1
Joined: Thu Aug 04, 2022 9:25 am

Post by Simonselles »

Fun fact: we don't need to print all the values after flooding. :facepalm:
After a long struggle, I went down to 20241 with printing.
Post Reply