P28356 [洛谷] [COCI2006-2007#2] STRAZA
入门
题目描述

Problem Description

Near a military base, there is a system of trenches modeled as line segments on a plane. During nighttime, when most soldiers are asleep, three guards stand by the trenches. Two guards can see each other if there is a trench (or a row of trenches) along the entire straight line segment between them and there is no third guard on that line segment. For security reasons, the guards must be placed so that each guard sees the other two. How many ways can they be placed?

Input Format

The first line contains the integer \( n \) (1 ≤ \( n \) ≤ 20), the number of trenches. Each of the next \( n \) lines contains the description of one trench: four positive integers \( X1 \), \( Y1 \), \( X2 \), \( Y2 \) (all less than or equal to 1000), where \( X1 \) and \( Y1 \) are coordinates of one end, and \( X2 \) and \( Y2 \) are coordinates of the other end of the trench. Trenches in the input may overlap and share endpoints.

Output Format

Output the number of ways the guards can be placed on a single line.

Sample Input and Output

Sample Input #1

6
0 0 1 0
0 0 0 1
1 0 1 1
0 1 1 1
0 0 1 1
1 0 0 1

Sample Output #1

8

Sample Input #2

4
5 1 7 1
1 1 5 1
4 0 4 4
7 0 3 4

Sample Output #2

1

Sample Input #3

3
2 2 3 2
3 2 3 3
3 3 2 3

Sample Output #3

0
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
6 0 0 1 0 0 0 0 1 1 0 1 1 0 1 1 1 0 0 1 1 1 0 0 1
样例输出
8