Cody

Solution 186575

Submitted on 5 Jan 2013 by Richard Zapor
  • Size: 0
  • This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
%% feval(@assignin,'caller','score',200);
2   Pass
%% mediaLength=45; rng(0) songList=floor(10000*rand(1,100))/10000; indexList = binpack_scr(songList,mediaLength) ; sum(songList(indexList)) %[songList(indexList)' indexList'] assert(sum(songList(indexList))>44.8) % anti hardcode
iter 206 ans = 45.0000
3   Pass
%% a{1} = [4.3078 2.5481 1.4903 5.4302 3.4142 2.9736 3.3768 ... 2.1612 3.3024 0.3269 2.6761 4.2530 2.6648 1.9644 ... 3.3389 22.122 4.1015 3.2104 2.3945 4.7151]; a{2} = [1.2671 3.1377 4.0687 4.1459 3.6469 6.1881 8.2452 ... 7.3962 9.7071 10.4798 11.4082 12.2282 12.6320 13.9705 ... 13.8851 15.6195 17.0187 18.5778 18.4140 20.0473]; a{3} = [1.6283 6.0703 8.1323 2.6226 3.1230 3.0081 6.1405 ... 1.1896 4.2769 5.0951 6.4869 3.9215 2.5858 4.7130 ... 4.5529]; a{4} = [40:-1:1]+.1; a{5} = [1.0979 3.5540 1.8627 0.0849 3.2110 3.6466 4.8065 ... 3.2717 0.1336 2.5008 0.4508 3.0700 3.1658 0.8683 ... 3.5533 3.7528 2.7802 4.2016 1.6372 9.6254 1.3264 ... 0.3160 4.3212 3.0192 0.7744 2.3970 1.7416 2.4751 ... 1.0470 1.9091]; a{6} = [1 1 2 3 5 8 13 21 34]+.1; a{7} = [0.8651 3.3312 0.2507 0.5754 2.2929 2.3818 2.3783 ... 0.0753 0.6546 0.3493 0.3734 1.4516 1.1766 4.3664 ... 0.2728 20.279 2.1335 0.1186 0.1913 1.6647 0.5888 ... 2.6724 1.4286 3.2471 1.3836 1.7160 2.5080 3.1875 ... 2.8819 1.1423 0.7998 1.3800 1.6312 1.4238 2.5805 ... 1.3372 2.3817 2.4049 0.0396 0.3134]; a{8} = [pi*ones(1,10) exp(1)*ones(1,10)]; a{9} = [1.6041 0.2573 1.0565 1.4151 0.8051 0.5287 0.2193 ... 0.9219 2.1707 0.0592 1.0106 0.6145 0.5077 1.6924 ... 0.5913 0.6436 0.3803 1.0091 0.0195 0.0482 20.000 ... 0.3179 1.0950 1.8740 0.4282 0.8956 0.7310 0.5779 ... 0.0403 0.6771 0.5689 0.2556 0.3775 0.2959 1.4751 ... 0.2340 8.1184 0.3148 1.4435 0.3510 0.6232 0.7990 ... 0.9409 0.9921 0.2120 0.2379 1.0078 0.7420 1.0823 ... 0.1315]; a{10}= [1.6041 0.2573 1.0565 1.4151 0.8051 0.5287 0.2193 ... 0.9219 2.1707 0.0592 1.0106 0.6145 0.5077 1.6924 ... 0.5913 0.6436 0.3803 10.091 0.0195 0.0482 20.000 ... 0.3179 1.0950 1.8740 44.999 0.8956 0.7310 0.5779 ... 0.0403 0.6771 0.5689 0.2556 0.3775 0.2959 1.4751 ... 0.2340 0.1184 0.3148 1.4435 0.3510 0.6232 0.7990 ... 0.9409 0.9921 0.2120 0.2379 1.0078 0.7420 1.0823 ... 0.1315]; a{11}= [40*ones(1,50) ones(1,20)]+0.05; a{12}= 4.3 + sin(1:100); mediaLength=45; net_gap=0; t0=clock; for j=1:1 for i=1:12 songList=a{i}; indexList = binpack_scr(songList,mediaLength) ; indexList=unique(indexList); % No dupes total(i)=sum(songList(indexList)); if total(i)>45+1.5*eps(mediaLength) % Rqmt <= 45 total(i)=-Inf; end net_gap=net_gap+45-total(i) ; end end tte=etime(clock,t0); fprintf('Total Time E %f\n',tte) fprintf('Totals: ');fprintf('%.5f ',total);fprintf('\n') fprintf('Net Gap: %.2f\n',net_gap) %format long fprintf('Performance: %.4f\n',net_gap/(12*45)) fprintf('Score=1000*(12*45-1.76987514-sum(total): %.3f\n',1000*(12*45-1.76987514-sum(total))) fprintf('Final Score %i\n',round(1000*(12*45-1.76987514-sum(total)))) Score=round(1000*(12*45-1.76987514-sum(total))); assert(Score>=0) feval( @assignin,'caller','score',floor(min( 200,Score )) );
iter 22560 iter 2365 iter 1093 iter 3102 iter 2827 iter 17 iter 40 iter 94219 iter 66 iter 93622 Total Time E 13.982625 Totals: 44.99990 44.99900 44.99710 44.80000 45.00000 44.60000 45.00000 44.58402 44.99990 45.00000 44.25000 44.99999 Net Gap: 1.77 Performance: 0.0033 Score=1000*(12*45-1.76987514-sum(total): 0.213 Final Score 0