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

Imre 5

by Imre Polik

Status: Passed
Results: pass
CPU Time: 36.492
Score: 235.0
Submitted at: 2003-11-06 11:55:24 UTC
Scored at: 2003-11-06 12:56:02 UTC

Current Rank: 79th
Based on: 7th try! (diff)

Comments
Please login or create a profile.
Code
n = size(a, 1);

S = {1};

D = (1:n)/0;

P = cell(1,n);

while numel(S)

   p = S{end};

   S(end)=[];

   t = a(p(end),:);

   k = setdiff(find(t), p);

   for q = k

      r = [p q];

      S{end+1} = r;

      d = 0;

      for i = 2:nnz(r)

         d = d + norm(b(r(i),:) - b(r(i-1),:));

      end

      u=r(end);

      if d < D(u)

         D(u) = d;

         P{u} = r;

      end

   end

end



D(D>9e9)=0;

[i j]=max(D);

c=P{j};