Question: Please write pseudocode or Python for a thumbs up. :) 1 Q1 We are given a set of n spies each of whom needs to

Please write pseudocode or Python for a thumbs up. :)

Please write pseudocode or Python for a thumbs up. :) 1 Q1

1 Q1 We are given a set of n spies each of whom needs to meet exactly one messenger from a set of n messengers and a set of possible locations [l] = {1,... ,l} where they can meet. For each spy i, there is a subset Si C [l] of the possible locations where spy i can go. Similarly, there is a subset Mi C [l] of the possible locations where messenger i can go. Moreover, each location j can handle at most cj pairs of spy-messenger meetings. The task is to decide if there is a possible way to match up spies and messengers such that every pair meets at one of their common locations. Formally, does there exist a permutation o on n vertices (mapping spies to messengers) and a function f : [n] [l] mapping spies to locations such that 1. Vi [n], f(i) e Sin Mo(i) (every spy-messenger pair meets at a location which they can both visit) 2. Vj E [l],{i | f(i) = j}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!