Faces of a Planar Graph
Easy
Execution time limit is 1 second
Runtime memory usage limit is 256 megabytes
Count the number of faces in a planar graph.
Input
The first line contains two integers, N and M (N ≤ 100) - representing the number of points on the plane and the number of segments, respectively.
The next N lines each contain a pair of integers x, y (|x|, |y| ≤ 10^4) - these are the coordinates of the points. Following this, the next M lines each contain a pair of integers ranging from 1 to N - these are the indices of the points that are connected by each segment.
The graph does not contain loops or multiple edges, and the segments do not intersect, ensuring that the graph is planar.
Output
Output a single integer G - the number of faces in the given planar graph.
Examples
Input #1
Answer #1
Submissions 59
Acceptance rate 27%