The country of Nodeland has n cities labeled from 0 to n - 1. A new flash sale for jewelry is about to
begin in this country. The organizers have decided on the M busiest cities as the market locations, as
they are the best locations for conducting the event. For security reasons, all jewelry will be kept in one
heavily guarded godown On the day of the sale, these jewelry items will be taken to the markets
Since there is only one godown, the marketplaces must be in adjacent cities. Identify the cities where
the organizers can build their godown
The following conditions must be kept in mind when deciding on the cities.
Two cities are adjacent if there is a direct road connecting both the cities.
· The godown cannot be in a city with a marketplace to keep the crowd away from the godown.
If there is no such city, return -1 stating that the organizers have to re-plan the market layout,
All cities are 0-indexed
The connecting roads are bi-directional
Input Specification:
input1: N the number of cities in the country
input2: M the number of market places
input3: An array of size m containing the list of all cities sorted in ascending order where
the markets will be built
input4: A 2-D array with dimensions n * n. The jh column of the ith row implies that city i
is connected to city 'y by one bridge
output specification:
the number of cities where the godown can be placed
i need answer in java prompt
Answers
Answered by
0
Answer:
country of Nodeland has n cities labeled from 0 to n - 1. A new flash sale for jewelry is about to
begin in this country. The organizers have decided on the M busiest cities as the market locations, as
they are the best
Explanation:
Yan Lang po Alam ko. Sana nakatulog...
Similar questions