Finish 2012-11-07 16:00:00 UTC

Patella

by Pavan

Status: Passed
Results: 12876 (cyc: 2, node: 146)
CPU Time: 39.622
Score: 12881.2
Submitted at: 2012-10-31 17:45:38 UTC
Scored at: 2012-11-01 14:45:36 UTC

Current Rank: 1598th (Highest: 1st )
Based on: Tibia (diff)

Comments
Please login or create a profile.
Code
function xyOut = solver(a, xyIn, wts)

xyIn = xyIn*100;
for z = 1:50
   xyIn = round(cell2mat(cellfun(@(a_row) mean(xyIn(a_row==1, :), 1), num2cell(a, 1), 'uni', false)'));
   tweak_overlap
end

xyOut = xyIn;

    function tweak_overlap
        [u I J] = unique(xyIn, 'rows');
        n = size(xyIn, 1) - size(u, 1);
        while(n>0)
            xyIn(setdiff(1:length(xyIn), I), :) = xyIn(setdiff(1:length(xyIn), I), :) + ones(n, 2) *  [1 0 ; 0 -1];
            [u I J] = unique(xyIn, 'rows');
            n = size(xyIn, 1) - size(u, 1);
        end
    end

end