Answer in C++ only In order to expand its reach to the outer universe and ensure universal peace, the MIB has decided to expand its offices. Namely, it has established its office on NN most important planets in the universe, with the base station on the planet S. Each office has an intergalactic teleporter that connects it to other planet offices. But the teleporters are bound to a planet's policy, so you cannot teleport to any planet you wish. Due to intergalactic feuds, the planets are divided into KK different alliances, numbered 1 through KK. You know for each planet i, the alliance that it belongs to. In other words, you're given a sequence A1,A2..., An, which says that planet ii belongs to alliance A_{i}. Each planet ii has a policy of teleportation to the planets of other alliances: Cost to travel from one planet to another is determined by the alliance of the destination planet. More formally, the cost to reach a planet which belongs to alliance j from planet ii is represented as C_{i, j}. Intra-alliance travel is free, i.e., if A_{i} = j, then C_{i, j} = 0 For a planet ii, there are some forbidden alliances as well. For these alliances, C_{i, j} = -1, given that alliance j is forbidden to travel from planet i. As MIB is bound to follow the intergalactic rules and since they have limited funds (yes, the government is cheap everywhere), they have decided to find the most optimal way to travel to each of the planets from the base station at planet SS. With all other agents busy with their missions, you are assigned the task to find these minimum-cost paths. This is your first task in MIB, so don't let them down! Input 534 13122 05-1 -140 03-1 40-1 403 Output 43400

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Answer in C++ only
In order to expand its reach to the outer universe and ensure universal peace, the MIB has decided
to expand its offices. Namely, it has established its office on NN most important planets in the
universe, with the base station on the planet S. Each office has an intergalactic teleporter that
connects it to other planet offices. But the teleporters are bound to a planet's policy, so you cannot
teleport to any planet you wish. Due to intergalactic feuds, the planets are divided into KK different
alliances, numbered 1 through KK. You know for each planet i, the alliance that it belongs to. In other
words, you're given a sequence A1,A2...,An, which says that planet ii belongs to alliance A_{i}.
Each planet ii has a policy of teleportation to the planets of other alliances:
Cost to travel from one planet to another is determined by the alliance of the destination
planet. More formally, the cost to reach a planet which belongs to alliance j from planet ii is
represented as C_{i, j}. Intra-alliance travel is free, i.e., if A_{i} = j, then C_{i, j} = 0
For a planet ii, there are some forbidden alliances as well. For these alliances, C_{i, j} = -1,
given that alliance j is forbidden to travel from planet i.
As MIB is bound to follow the intergalactic rules and since they have limited funds (yes, the
government is cheap everywhere), they have decided to find the most optimal way to travel to each
of the planets from the base station at planet SS. With all other agents busy with their missions, you
are assigned the task to find these minimum-cost paths. This is your first task in MIB, so don't let
them down!
03-1
40-1
403
Input
534
13122
05-1
-140
Output
43400
Transcribed Image Text:Answer in C++ only In order to expand its reach to the outer universe and ensure universal peace, the MIB has decided to expand its offices. Namely, it has established its office on NN most important planets in the universe, with the base station on the planet S. Each office has an intergalactic teleporter that connects it to other planet offices. But the teleporters are bound to a planet's policy, so you cannot teleport to any planet you wish. Due to intergalactic feuds, the planets are divided into KK different alliances, numbered 1 through KK. You know for each planet i, the alliance that it belongs to. In other words, you're given a sequence A1,A2...,An, which says that planet ii belongs to alliance A_{i}. Each planet ii has a policy of teleportation to the planets of other alliances: Cost to travel from one planet to another is determined by the alliance of the destination planet. More formally, the cost to reach a planet which belongs to alliance j from planet ii is represented as C_{i, j}. Intra-alliance travel is free, i.e., if A_{i} = j, then C_{i, j} = 0 For a planet ii, there are some forbidden alliances as well. For these alliances, C_{i, j} = -1, given that alliance j is forbidden to travel from planet i. As MIB is bound to follow the intergalactic rules and since they have limited funds (yes, the government is cheap everywhere), they have decided to find the most optimal way to travel to each of the planets from the base station at planet SS. With all other agents busy with their missions, you are assigned the task to find these minimum-cost paths. This is your first task in MIB, so don't let them down! 03-1 40-1 403 Input 534 13122 05-1 -140 Output 43400
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY