Milling Machines

From programming_contest
Revision as of 07:40, 25 September 2018 by Kmk21 (talk | contribs) (Created page with "This problem gives us a set (10k) of differently sized X by Y grids, and a pattern of (10k) steps of removing various parts of them and asks us to output the final size of eac...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This problem gives us a set (10k) of differently sized X by Y grids, and a pattern of (10k) steps of removing various parts of them and asks us to output the final size of each. If we take the naive approach and apply each pattern to each grid, we have 10^8 steps, each of which requires 10^2 (100) updates. This is too slow. Instead, we can realize that we can combine all the steps into one final output (All that matters is the FURTHEST we drill in each of the 100 X coordinates), and then apply that to each of the 10k grids. This is 10^6 and is plenty fast.