P25497 [AtCoder] [ABC033D] Classification of Triangles
提高
题目描述

Problem Description

Given $ N $ points on a 2D plane, the coordinates of the $ i $-th point are $ (x_i, y_i) $. Note that no three points are collinear.

Consider forming a triangle by selecting any three points out of the $ N $ points. There are a total of $ N * (N - 1) * (N - 2) / 6 $ such triangles. Determine the number of acute, right, and obtuse triangles among them.

An acute triangle is one where all three angles are less than $ 90° $. A right triangle is one where exactly one angle is $ 90° $. An obtuse triangle is one where exactly one angle is greater than $ 90° $.

Input Format

The input is given from the standard input in the following format:

$ N $ $ x_1 $ $ y_1 $ $ x_2 $ $ y_2 $ : $ x_N $ $ y_N $

  • The first line contains an integer $ N (3 ≦ N ≦ 2,000) $, representing the number of points.
  • The next $ N $ lines contain the coordinates of the points. The $ i $-th line contains integers $ x_i (-10,000 ≦ x_i ≦ 10,000) $ and $ y_i (-10,000 ≦ y_i ≦ 10,000) $ separated by a space.
  • All $ N $ points are distinct.
  • No three different points are collinear.

Output Format

Output the number of acute triangles, right triangles, and obtuse triangles in this order, separated by spaces, in one line.

Ensure to include a newline at the end of the output.

Sample Input and Output

Sample Input #1

5
1 3
2 2
3 2
4 1
4 3

Sample Output #1

1 2 7

Sample Input #2

9
2 0
1 1
3 1
1 2
5 2
0 3
4 3
2 4
4 4

Sample Output #2

27 14 43

Notes/Hints

Partial Points

This problem has partial points.

  • If you solve the dataset where $ N ≦ 100 $ correctly, you will be awarded 30 points as partial credit.

Sample Explanation 1

  • Selecting the 2nd, 4th, and 5th points forms an acute triangle.
  • Selecting the 1st, 4th, and 5th points forms a right triangle.
  • Selecting the 3rd, 4th, and 5th points forms a right triangle.
  • The other 7 combinations form obtuse triangles.
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
5 1 3 2 2 3 2 4 1 4 3
样例输出
1 2 7