HI,

I could not get this one to pass either, i still don't understand why, it must 
be the way i fill the board (I ran the actual recursion algorigthm on both 
failures and successes and checked the number of cells left to be revealed and 
they were consistent with my results)

If R or C == 1 then it is always possible

otherwise, i calculate a rectangle top left of the board with width C-2 and 
height R-2, i call that a buffer zone, as long as M fits in that buffer zone it 
is possible (I fill it column by column: from top to bottom and from left to 
right)

If M > bufferzone then i start filling the rectangle underneath it, so at max 2 
rows height, and at most C-2 columns width. In this area i say the board will 
be ok as long as the number of mines in this container is even. I fill this 
rectangle from top to bottom and from left to right.

after this lower rectangle is filled, if there are more mines remaining i do 
the same thing with the rectangle right of the buffer zone (this is a rectangle 
with at most 2 columns and R-2 rows). I fill this from top to bottom, from left 
to right. As long as the number of mines in this rectangle is even, it is ok.

at this point there could be at most 3 more mines (requirements say M < R*C.

IF remaining = 3 then it is possible (all mines except the clicked c), 
otherwise it is impossible.

I am still baffled why it didn't pass, there must be some corner case or the 
way i fill it is not correct, any ideas?

I suppose ill have to just run the data set against one of the passed ones and 
compare

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/e0086e83-64ae-47d6-a070-2c9ccc3fb602%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to