Question
Input Format The first line of input contains a single integer n (1n55) the number of pathways. Each of the following n lines contains two
Input Format
The first line of input contains a single integer n (1n55) the number of pathways. Each of the following n lines contains two integers xi and yi (1xi,yi1000) the coordinates of the i-th pathway. Note that the north direction coinides with the direction of y axis, so the east direction coinides with the direction of the x axis. All pathways locations are distinct.
Constraints
n (1n55) (1xi,yi1000)
Output Format
Output the minimal number of pathways that need to be created in order for Zahir to be able to reach any pathway from any other one.
Sample Input 0
2 2 1 1 2
Sample Output 0
1
Any Language: Java , Python, C, Javascript
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started