409827: GYM103800 D Ginger's line
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
D. Ginger's linetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
Ginger have $$$n$$$ straight lines $$$y = a_i x + b_i$$$, now Ginger wants to know how many pairs of straight lines $$$i,j(i<j)$$$ intersect.
InputThe first line contains a integer $$$n$$$ $$$(1 \le n \le 5 \times 10 ^ 3)$$$ indicating the number of lines.
The next $$$n$$$ lines contains two integers $$$a_i, b_i$$$ $$$(-10 ^3 \le a_i, b_i \le 10^3)$$$ indicating line $$$y = a_i x + b_i$$$.
OutputPrint the pairs of intersections of lines.
ExamplesInput5 1 1 2 2 3 3 4 4 5 5Output
10Input
2 1 0 1 0Output
0Note
Note that overlapping lines do not intersect.