Fişierul intrare/ieşire:lpaths.in, lpaths.outSursăIIOT 2021-22 Runda 4
AutorStefan DascalescuAdăugată destefdascalescuStefan Dascalescu stefdascalescu
Timp execuţie pe test0.5 secLimită de memorie65536 kbytes
Scorul tăuN/ADificultateN/A

Vezi solutiile trimise | Statistici

Lpaths

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 lines 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 that he is interested in finding the number of parallel L-shaped paths he can find in the given star map.

A parallel L-shaped path is a sequence of three stars which form an L-shape and it 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).

Date de intrare

The first line of the input file lpaths.in contains n, the number of stars.

The next line of the input contains the coordinates of the n stars. All stars are distinct.

Date de ieşire

The output file lpaths.out contains the number of L-shaped paths we have in the star map. 

Restricţii

  • 1 ≤ n ≤ 2 * 10^5
  • 0 ≤ x, y ≤ 2 * 10^5
  • For tests worth 20 points, 1 ≤ n ≤ 200
  • For tests worth 30 more points, 1 ≤ n ≤ 2000.

Exemplu

lpaths.inlpaths.out
5
5 5
8 5
5 8
5 0
0 5
4
Trebuie sa te autentifici pentru a trimite solutii. Click aici

Cum se trimit solutii?