Problem 1136. Knots Contest: Score (ContestSuite)

Solution 2525424

Submitted on 12 Jun 2020
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

2   Fail
tic %urlwrite('','Knots_contest.mat') %urlwrite('','numKnots.m') % Fast numKnots urlwrite('','Knots_contest.mat') toc urlwrite('','numKnots.m') % Fast numKnots rehash path % Make numKnots.m available toc

Error using urlreadwrite (line 98) Error downloading URL. Your network connection may be down or your proxy settings improperly configured. Error in urlwrite (line 52) [f,status] = urlreadwrite(mfilename,catchErrors,url,filename,varargin{:}); Error in Test2 (line 5) urlwrite('','Knots_contest.mat')

3   Fail
cases=50; nKnots=zeros(cases,1); KnotTime=zeros(cases,1); load Knots_contest.mat for n=1:cases a=testsuite(n).a; xyIn=testsuite(n).xyIn; wts=testsuite(n).wts; rng(2,'twister') time0 = cputime; xyOut=solver(a,xyIn,wts); KnotTime(n) = cputime - time0; if size(unique(xyOut,'rows'),1)<length(wts) nKnots(n)=Inf; % Points must be unique else nKnots(n)=numKnots(xyOut,a); end end for n=1:cases fprintf('%2i KnotTime(msec) %5i Knots %4i\n',n,floor(KnotTime(n)*1000),nKnots(n)) end TKnotTime=sum(KnotTime); fprintf('Sum KnotTime %5i msec\n',floor(TKnotTime*1000)) T_score=6.5*exp(TKnotTime/23); Tknots=sum(nKnots);; fprintf('Time Score %10.2f\n',T_score) fprintf('Knot Score %10.2f\n',Tknots) fprintf('Total Score %10.2f\n',Tknots+T_score) fprintf('Cody Maximum allowed Elapsed time is approximately 53 seconds\n') toc feval( @assignin,'caller','score',min( 2000,Tknots+floor(T_score) ) );

Error using load Unable to read file 'Knots_contest.mat'. No such file or directory. Error in Test3 (line 5) load Knots_contest.mat