Finish 2000-03-27 00:00:00 UTC

radio_lineedit

by G Hunyadi

Status: Passed
Results: 100
CPU Time: 23.124
Score: 51696.1
Submitted at: 2000-03-24 14:08:52 UTC
Scored at: 2000-03-24 14:11:35 UTC

Current Rank: 112th
Based on: radiocity (diff)

Comments
Please login or create a profile.
Code
function gene = test(a0)
[n,L] = size(a0);
[sums is]  = sort( a0 * rand(L,1) )  ;
a0 = a0( is(diff([sums ; 0]) ~= 0), :);
nii = size(a0,1) ;
a = cell(nii,1);
for k = 1:nii,
   a{k} = a0(k,:);
end;
gTail = 2-L:0;
for N = L-1:-1:1,
   i1 = 1;
   while i1<=nii,
      while 1,
         cPart = find(strncmp(a{i1}(end+gTail),a, N));
         if cPart,
            mSeg = cPart(1);
            if mSeg~=i1,
               a{i1} = [a{i1} a{mSeg}(1+N:end)];
               nii=nii-1;
               if nii == 1,
                  gene = a{i1};
                  return;
               end;
               if mSeg<i1, i1=i1-1; end;
               a(mSeg) = [];
            else
                  break;
            end;
         else
            break;
         end;
      end;
      i1=i1+1;
   end;
   gTail(1) = [];
end;
gene = [a{:}];