For each square you can find, you can map it to another square that has
side parallel to the axis with minimum size and yet contains the square you
just find.
[image: pasted2]

you can easily find that, for each blue square with size X, there are
exactly X red square mapping to it.

Since you have R row and C col, you can first find that there are

(R - X) * (C - X) squares with size X
so the total answer for red square is

Sigma x from 1 to min(R - 1, C - 1) | (R - X) * (C - X) * X

Since R and C can both very large, it is not efficient to use a loop to
calculate the value above. I will leave the rest as exercises to you.

Sb B <[email protected]>于2017年3月6日周一 上午5:26写道:

> Hi all,
> Thanks in advance, I'm am new to code jam and the first problem itself I
> cannot understand the solutio.
> This is kickstart round 1a problem fitting squares.
> CaN someone explain me the solution?
> Regards.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-code/ef828cbb-3414-4570-a7ec-0e0de154ec18%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/CAGDEU-%2BBtHOdpTQKHYFrvhDoJs-74yVL6s%3DnE%2B6cu7Je1_5wGQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to