Strange Constellations (constellation)

150 teams scored 10775 points on this task, for a maximum score of 100, an average score of 72 and a median score of 65.

Highlights

  1. ITI Planck, Villorba is the institute with the most points (390).
  2. Lombardia is the region with the most points (2455).

Statement

Back when he was little, Stefan used to look a lot at the sky during the night, hoping to see various kinds of stars and to imagine different kinds of shapes which can be drawn amongst them. Looking back at his childhood, he realized that he can now use the computer to refine this process! Therefore, he gives you the 2D map of the stars during one particular night, and he tells you that there were N stars on the sky. Furthermore, he also tells you the position (x_i, y_i) of each star. Stefan is interested in finding parallel L-shaped constellations. A parallel L-shaped path is a sequence of three stars which form an L-shape and each side is parallel to the coordinate axes. The L can have its sides rotated, as long as it still forms an L. Furthermore, the L can’t be degenerated (i.e. a straight line or a dot). Help Stefan find the number of parallel L-shaped constellations in the given star map!