Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

There is a disaster in Los Angeles, and all the students at UCLA want to get on a school bus and gather at a shelter

image text in transcribedimage text in transcribed There is a disaster in Los Angeles, and all the students at UCLA want to get on a school bus and gather at a shelter outside of Los Angeles. There are several nodes in Daegu, each connected by a road. Each road has a maximum number of buses that it can accommodate, and you need to plan the optimal route to evacuate as many students as possible. Write a program that outputs the maximum number of buses that can reach the shelter given the conditions below. Conditions UCLA has a node number of 0 and the shelter has a node number of n1. The school buses are all traveling on the same road. The direction of the given road is one-way. There are 0 to 2 roads between any two nodes. You believe that there are no roads that lead directly from UCLA to the shelter. There is no way to get to the shelter from UCLA. Input Format On the first line, the number of neighborhoods, n, and the number of roads, m, are given, separated by spaces. (3n250,2m500,n,m are integers) From line 2 to line m+1, the information of each road is given, separated by a space. The road information consists of three integers, which represent the starting zone ai, the ending zone bj, and the vehicle capacity ci of the two zones connected by the road. (1ci1000, where ci is an integer) Output Format Output the maximum number of buses that can reach the shelter on the first line. Write in Python, and use Min-Cut Max-Flow Theorem. Timeout per a testcase 0.36 s. 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

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions