Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The ACM Club president, Jordan Mosakowski, is very curious about how far indoors he can get inside SCU, so he asks you to help him
The ACM Club president, Jordan Mosakowski, is very curious about how far indoors he can get inside SCU, so he asks you to help him with the task. He defines how indoors a room is by the minimum number of doors you can go through to go from the room to the outdoors or from the outdoors to the room. For example, the furthest inside he can be in SCDI is a factor of since you enter any set of doors from the outside, then enter a certain classroom that has a closet, then enter the closet. However, a door such as a bathroom stall door does not count as being more indoors because you don't enter a new room. Given a building as a list of D doors connecting rooms to each other or connecting a room Ri to the outside, determine how far indoors you can be in the building and determine the rooms that are the most indoors.
Input Format
The first line is the number of doors in the building.
Each of the following rows of input consists of rooms i and j that indicate that i and j are connected by a door. There are cases where i j like the bathroom stall door
Constraints
D
Ri
Output Format
The first line is how far indoors you can be inside of the building.The second line is the room numbers that are the most indoors, sorted by room number.
Sample Input
Sample Output
Explanation
Start outside indicated by go to room then go to room then room then room It takes doors to
get to room Start outside, go to room then go to room then room then room It takes doors to
get to room It can be shown that and are the rooms that are the most indoors with a factor of
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