AtCoder Beginner Contest 131 Task F. Must Be Rectangular

Score: 600 points

Approach

Fixed abscissa $ x $, $ X $ abscissa is considered a vertical line can be up to several points.

Observations

If the first two vertical lines $ x_1 $, $ x_2 $ there is a $ Y $ ordinate point, the

  • The two vertical lines of points can be "merged"
  • The final point of the two vertical lines must be the same as

We found that the equivalence between the vertical lines: two lines have the same vertical ordinate points.
With disjoint-set to maintain this equivalence relation. The combined to a vertical line with the point of equivalence class.

Guess you like

Origin www.cnblogs.com/Patt/p/11846215.html