Finish 2010-05-05 12:00:00 UTC

dry run again

by Chethan C U

Status: Passed
Results: 1168746558 (cyc: 4, node: 259)
CPU Time: 72.737
Score: 2337510.0
Submitted at: 2010-04-29 16:51:27 UTC
Scored at: 2010-04-29 16:52:54 UTC

Current Rank: 4228th (Highest: 412th )
Based on: dry run (diff)
Basis for: 2d with filters (diff)

Comments
Alan Chalker
10 May 2010
This entry was submitted during the Twilight phase
Alan Chalker
11 May 2010
This entry gets a result of 2001057675 on the test suite (832311117 more than the contest suite). It has a ranking of 4212 compared to all other entries run against the test suite according to the data set provided by Jan Keller.
Please login or create a profile.
Code
function Aest = solver(imageSize, queryLimit)
    

    Aest = zeros(imageSize);
    Mask = false*zeros(imageSize);
    Num=ceil((imageSize*imageSize)/queryLimit); % Can be floor/ceil
    [m,n]=FindMN(Num);

    for ii=1:ceil(imageSize/m)
        for jj=1:ceil(imageSize/n)
        Mask=false(imageSize);
        Mask((ii-1)*m+1:m*ii,(jj-1)*n+1:n*jj)=true(m,n);
        Mask=Mask(1:imageSize,1:imageSize);
        LocalSum=queryImage(logical(Mask));
        LocalAvg= round(LocalSum/m);
        Aest((ii-1)*m+1:m*ii,(jj-1)*n+1:n*jj)=LocalAvg*ones(m,n);
       Aest=Aest(1:imageSize,1:imageSize);
        end
    end     
end    

function [m,n]=FindMN(Num)
%can be sqrt algo.
%m =floor(sqrt(Num));
%n =ceil(Num/m);
 if (isprime(Num))
     Num=Num+1;              % Can be Num-1
 end
     L=factor(Num);
     len=length(L);
     m=prod(L(1:floor(len/2)));
     n=prod(L(floor(len/2)+1:end));
 if Num<1
     m=1;
     n=1;
 end
 if Num==3 % actual no. is 2.
     m=2;
     n=1;
 end
end