Finish 1998-12-21 00:00:00 UTC

first long, then short ones

by Juan Chilla

Status: Passed
Results: 3.39% blank
CPU Time: 1.322
Score: 647.208
Submitted at: 1998-12-14 21:51:20 UTC
Scored at: 2000-03-16 16:51:51 UTC

Current Rank: 630th
Based on: should be fast (diff)
Basis for: pseudo recursive (diff)

Comments
Please login or create a profile.
Code
function indexList = binpack(songList, mediaLength)
%  trivial attempt, but should be fast
%  trying to add some songs
%
[s j]=sort(-songList);
m=length(j);
s1=cumsum(-s);
n=max(find(s1<mediaLength));
nn=min(find((s1(m)-s1-s(m))<(mediaLength-s1(n))))+1;
indexList=j([1:n nn:m]);