Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You have recently been running to and from school and your dorm to improve your fitness. Your running route can be mapped to an undirected

image text in transcribedimage text in transcribed You have recently been running to and from school and your dorm to improve your fitness. Your running route can be mapped to an undirected unweighted graph of n nodes. Your school and dorm are nodes. You are tired of running the same route every time, so you don't visit a node once. Write a program that outputs the maximum number of round trips from school to dormitory that satisfy the given conditions. Conditions The school has a node number of 0 and the dorm has a node number of n1. There is no direct path between a school node and a dorm node. Consider one trip each way from school to dorm or from dorm to school as one trip. All roads are bi-directional. There are 0 to 1 roads between any two nodes. Schools and dormitories can be visited multiple times. Input Format On the first line, the sum of the number of schools, dormitories, and all shelters, n, and the number of roads connecting each node to schools and dormitories, m, are given, separated by spaces. (3n300,2m10,000,n,m are integers ) On each line from line 2 to line m+1, the start and end points of the paths are given, separated by a space. (The two points are integers from 0 to n1 ) Output Format Print the maximum number of trips to and from the school and dormitory on the first line. Write in Python, and use Min-Cut Max-Flow Theorem. Timeout per a testcase 3.36s. therefore measuring time is necessary. Include it in the code. Important) I would be very grateful if you could attach a screenshot of whether the sample output comes out properly when you put in the sample input

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

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

More Books

Students also viewed these Databases questions