All submissions for this problem are available.
Given N separate integer points on the Cartesian plane satisfying: there is no any three of them sharing a same X-coordinate. Your task is to count the number of rectangles (whose edges parrallel to the axes) created from any four of given points.
There are several test cases (ten at most), each formed as follows:
- The first line contains a positive integer N (N ≤ 105).
- N lines follow, each containing a pair of integers (each having an absolute value of 109 at most) describing coordinates of a given point.
The input is ended with N = 0.
For each test case, output on a line an integer which is the respective number of rectangles found.
Input: 6 7 1 3 5 3 1 1 5 1 1 7 5 0 Output: 3
|Tags||anhdq, april11, easy|
|Time Limit:||0.176 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.