Cody

Solution 177409

Submitted on 14 Dec 2012 by Richard Zapor
  • Size: 166
  • 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',1000);
2   Pass
%% urlwrite('http://contest.usc.edu/index.php/Fall12/Home?action=download&upname=pits.in.txt','pits.in.txt');
3   Pass
%% fid=fopen('pits.in.txt','r'); t_expect=[19 2 2 3 -1 7 14 23 401 200 42 -1 27 -1]; t1=0; qty=fscanf(fid,'%i',1); for q=1:qty %qty n = fscanf(fid,'%f %f\n',2)'; % array size A=zeros(n); for i=1:n(1) strv=fgetl(fid); %A(i,:)=strv-'.'; A(i,:)=strv; end ta=clock; [t]=Pits(char(A)) ; t1=t1+etime(clock,ta)*1000; % Time in msec fprintf('%2i Cmds %3.0f Sum Time %.0f \n',q,t,t1) %isequal(t,t_expect(q)) assert(isequal(t,t_expect(q))); end % q t2=min(1000,t1); fprintf('Actual Time = %.1f msec\n',t1) feval(@assignin,'caller','score',floor(t2));
1 Cmds 19 Sum Time 62 2 Cmds 2 Sum Time 65 3 Cmds 2 Sum Time 65 4 Cmds 3 Sum Time 66 5 Cmds -1 Sum Time 66 6 Cmds 7 Sum Time 67 7 Cmds 14 Sum Time 71 8 Cmds 23 Sum Time 78 9 Cmds 401 Sum Time 117 10 Cmds 200 Sum Time 136 11 Cmds 42 Sum Time 158 12 Cmds -1 Sum Time 158 13 Cmds 27 Sum Time 163 14 Cmds -1 Sum Time 167 Actual Time = 166.9 msec