Lines
Time limit1sMemory limit1024 MB
Given N lines in the plane, some possibly coincident, count the regions they divide the plane into. Use Euler's formula with distinct intersection points.
- Level
Medium7 of 10
- Topics
- Geometry, Math, Hash map, Implementation
- Solved
- No attempts yet
Problem
The input gives lines in the plane. Write a program that finds the number of regions the plane is divided into by these lines. Some of the lines may coincide.
In the figure below, the plane is divided into 14 regions.

Input
The input consists of lines. The first line contains (). The -th line () contains four integers (, ) separated by spaces. This means that line passes through the two points and .
Output
Print the number of regions on a single line to standard output.
Hint
