Page 1 of 1

11581 - Grid Successors

Posted: Fri Feb 27, 2009 12:00 pm
I think this problem can't be a cycle...but why??? Can someone give me a proof please

Re: 11581 - Grid Successors

Posted: Fri Feb 27, 2009 12:28 pm
Check the first sample..

Code: Select all

``````111
100
001``````
Its f0(g). We can find f1(g) easily.

f1(g) = f( f0(g) )

This way we can construct all.

So,

Code: Select all

``````f0(g) =
111
100
001

f1(g) =
001
100
110

f2(g) =
110
101
011

f3(g) =
010
101
010

f4(g) =
000
000
000

f5(g) =
000
000
000

...
``````
fI(g) = f4(g). Here 'I' stands for infinity. So, 3 is the highest index for which the result is finite. So, the result is 3. Hope it helps.

Re: 11581 - Grid Successors

Posted: Sat Feb 28, 2009 1:54 am
Thank you!! I think this problem will always convergence to the zero matrix (3x3) for every grid, but i can't prove this. Actually my AC program shows the
feature.

Re: 11581 - Grid Successors

Posted: Tue Nov 05, 2013 11:29 am
Hey all, having trouble getting WA and tried some rudimentary test cases. Formatting looks good. Any hints?

DELETED - missed the new line at the very end =/

Re: 11581 - Grid Successors

Posted: Tue Nov 05, 2013 9:26 pm
Use class Main

Re: 11581 - Grid Successors

Posted: Sun Nov 24, 2013 6:57 pm
Sorry. Edited my response - (I modify my code to conform to the java submission instructions just prior to submitting)

Re: 11581 - Grid Successors

Posted: Tue Nov 26, 2013 11:23 pm
Print a newline char at the end of the last line.

Re: 11581 - Grid Successors

Posted: Sat Nov 30, 2013 6:54 am
ugh, thanks!

Re: 11581 - Grid Successors

Posted: Tue Sep 23, 2014 2:36 pm
Jan,
Thanks for the explanation. That really helped see things in perspective.

Also, I've uploaded input I found useful during testing / debugging on uDebug.