Editorial for An Animal Contest 5 P5 - Counting Rectangles
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Subtask 1
For each pair of horizontal lines, we can find the number of pairs of vertical lines that intersect both horizontal lines by looping through all vertical lines in order of their x-axis.
Time Complexity:
Subtask 2
For full marks, we need a faster way to query the number of rectangles. One possible solution is described here. For each horizontal line
Time Complexity:
Comments