Editorial for Topium
Submitting an official solution before solving the problem yourself is a bannable offence.
An impurity at
The plate will only contain the impurity (red) if its top left corner (black) is inside the blue box.
Draw the bounding rectangle of each impurity. Each rectangle has a value equal to the impurity strength. Find the highest possible total value of rectangles covering a point.
To solve this problem, store the left and right edges of each rectangle and sort them by
Coordinate compress the
Tips:
- You cannot cut outside of the gem, all edges of your cut must be between
and - Some impurities have negative values, so in some cases, it may be the best option to look for a pure fragment
- Make sure you include all impurities inside your cut when adding up the values, even the negative ones
Time Complexity:
Comments