codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

181B.md (1096B)


      1 Source: https://codeforces.com/problemset/problem/181/B
      2 
      3 B. Number of Triplets
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 You are given *n* points on a plane. All points are different.
     22 
     23 Find the number of different groups of three points (*A*, *B*, *C*) such that point *B* is the middle of segment *AC*.
     24 
     25 The groups of three points are considered unordered, that is, if point *B* is the middle of segment *AC*, then groups (*A*, *B*, *C*) and (*C*, *B*, *A*) are considered the same.
     26 
     27 Input
     28 
     29 The first line contains a single integer *n* (3 ≤ *n* ≤ 3000) — the number of points.
     30 
     31 Next *n* lines contain the points. The *i*-th line contains coordinates of the *i*-th point: two space-separated integers *x**i*, *y**i* ( - 1000 ≤ *x**i*, *y**i* ≤ 1000).
     32 
     33 It is guaranteed that all given points are different.
     34 
     35 Output
     36 
     37 Print the single number — the answer to the problem.
     38 
     39 Examples
     40 
     41 Input
     42 
     43 ```
     44 3  
     45 1 1  
     46 2 2  
     47 3 3
     48 ```
     49 
     50 Output
     51 
     52 ```
     53 1
     54 ```
     55 
     56 Input
     57 
     58 ```
     59 3  
     60 0 0  
     61 -1 0  
     62 0 1
     63 ```
     64 
     65 Output
     66 
     67 ```
     68 0
     69 ```