프로그램 명: empty-triangles
제한시간: 1 초

Do you know how easy it is to make a very simple problem into a brutally hard one? Here is an example. How many triangles can you make with N straight lines in the plane? As long as they have different slopes and no three of them meet at a single point, there will be N 3 triangles, which is the maximum possible you can get.

Okay, that wasn’t too bad. But let’s see what happens if we only count triangles that are empty (that is, none of the lines pass through the interior of the triangle). Then, the number of triangles suddenly becomes very small. For example, with 4 straight lines, we can only make 2 empty triangles, whereas the total number of triangles can be as big as 4. Refer to the diagram.

In fact, a general formula for the maximum number of empty triangles that can be drawn with N lines is not known. The hard part, however, is to find the right con?guration of the lines. Your job is much easier; given N straight lines on the plane, count the number of empty triangles.

입력

출력

Print out a single line that contains the number of empty triangles formed by the given lines.

입출력 예

입력

4
0 0 1 2
0 0 -1 2
1 0 1 1
-1 0 -1 -1

출력

2

입력

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

출력

0
출처:standford/2011/

[질/답] [제출 현황] [푼 후(0)]
[ 채 점 ] [홈으로]  [뒤 로]