Cody

Problem 1102. USC Fall 2012 ACM : Find Largest Water Concentration

Solution 1704811

Submitted on 8 Jan 2019 by William
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
%http://contest.usc.edu/index.php/Fall12/Home?action=download&upname=water.in.txt tic urlwrite('http://contest.usc.edu/index.php/Fall12/Home?action=download&upname=water.in.txt','water_in.txt'); toc

Elapsed time is 0.637633 seconds.

2   Pass
fid=fopen('water_in.txt','r'); w_area_expect=[8 16;100 100;0 1;1 1;5 9;186 675;23 110; 480 2500;102 2500;61 400; ... 73 930;160 441; 678 800; 55 361; 53 195;216 1296;199 1110;81 576;232 552;12 30;9 25;15 25;25 143; ... 66 120;2500 2500;270 1680;264 900;292 1365;748 2401;244 609;315 1296;214 1188]; qty=fscanf(fid,'%i',1); for q=1:qty n = fscanf(fid,'%i %i %i\n',3)'; % rows / cols / min rect s=n(3); n=n(1:2); strv=fgetl(fid); iswater=strv; A=zeros(n); % Format is rows, columns for i=1:n(1) strv = fgetl(fid); A(i,:) = strv; end A=char(A); [w,w_area]=Water_analysis(A,iswater,s); assert(isequal([w w_area],w_area_expect(q,:))); end fprintf('Processing Complete\n\n') fclose(fid); toc

Processing Complete Elapsed time is 3.579072 seconds.

Suggested Problems

More from this Author241

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!