Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago