## Mock CCC '22 2 S4 - Kaguya Wants to Build a Great Wall

View as PDF

Points: 15 (partial)
Time limit: 8.0s
Memory limit: 1G

Problem type

Kaguya is overseeing the construction of a new polygonal wall to protect Shuchi'in Academy from outsiders. The construction of the wall is as follows - Kaguya has hired workers. Kaguya will draw an -sided simple polygon, and then each worker will be responsible for building exactly one of the sides of the polygon. Each side of the polygon must have positive length.

The workers are very peculiar. Each worker owns an infinite line in the plane and will only build a side of the polygon if that side lies entirely on the infinite line the worker ones.

Compute the number of distinct walls that can be built. Two walls are distinct if and only if there is some point present in one wall that is not part of the other.

#### Constraints

All lines will be distinct.

In tests worth 1 mark, .

In tests worth 1 mark, .

In tests worth 1 mark, .

In tests worth 1 mark, .

In tests worth 1 mark, .

In tests worth 1 mark, .

In tests worth 1 mark, .

In tests worth 1 mark, .

In tests worth 1 mark, .

#### Input Specification

The first line contains an integer .

Each of the next lines contains four integers, , , , and , two points on the infinite line that the given worker owns.

#### Output Specification

Output the number of distinct polygons that can be constructed.

#### Sample Input 1

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

#### Sample Output 1

2

#### Sample Input 2

7
0 0 0 1
1 0 1 1
2 0 2 1
0 0 1 0
0 1 1 1
0 2 1 2
0 3 1 3

#### Sample Output 2

0

#### Sample Input 3

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

#### Sample Output 3

0