Winner Nicke (Revolution IV)

Finish 2003-11-13 15:00:00 UTC

Majestic Marseilles

by Colin Ross

Status: Passed
Results: pass
CPU Time: 24.105
Score: 231.0
Submitted at: 2003-11-06 17:44:59 UTC
Scored at: 2003-11-06 19:39:42 UTC

Current Rank: 32nd
Based on: Naughty Nice (diff)

Comments
Please login or create a profile.
Code
[n m]=size(a);
z=n*m;
p = num2cell(1:z);

for i=1:z
    for k=1:z
x = p{k};
        e=x(end);
        h = a(e)+1;
        g = e-1;
        w = e+n;
        
        f = mod(g,n);        
        if w<=z & a(w)==h
            x = [x w];
        elseif e>n & a(e-n)==h
            x = [x e-n];
        elseif f<n-1 & a(e+1)==h
            x = [x e+1];
        elseif f & a(g)==h
            x = [x g];
        end
        p{k} = x;
        d(k) = nnz(x);
    end
end
[v b]=max(d);
b = p{b}'