Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help modifiying the code in the picture to meet the following the requirements. I also included a picture of sample input / output

I need help modifiying the code in the picture to meet the following the requirements. I also included a picture of sample input/output.Given a network of n computers, a set of the pairs of computers that are initially connected, and a sequence of steps where connections are destroyed, one by one, calculate the connectivity (as defined in the problem specification above)after each connection is destroyed.The Input (must be read from standard input (no file i/o. use of file i/o will fail all the test cases and you will get zero)):The first line of input contains three space separated integers, n (1= n =105), m (1= m =3x105), and d (1= d = m),representing the number of computers in the enemy network, the number of connections between pairs of computers in the enemy network, and the number of those connections which you will destroy, respectively. The computers are numbered 1 through n, inclusive, and the connections are numbered 1 through m respectively.The following m lines will each contain a pair of distinct integers, u and v (1= u, v = n, u != v), representing that computers u and v are connected, initially. (Note: we denote the first of these lines as connection 1, the second as connection 2, and so forth.) It is guaranteed that each of the pairs listed will be unique pairs; namely, the same two values of u and v will never appear on two different lines as separate connections. (Of course, many individual computers will be connected to more than one other computer, so a particular value u may appear on more than one of these m lines.)The following d lines will each contain a unique integer in between 1 and m, inclusive, representing a connection number that gets destroyed. These will appear in the order that they get destroyed. The Output (standard console output): Output d+1 lines of output. The first line should be the initial connectivity of the network. The following d lines should have the connectivity of the network after each connection is destroy, one by one.
image text in transcribed

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

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

Job type Retail sales, managerial, human resources, etc.

Answered: 1 week ago