# Help!?

Printable View

• November 25th, 2013, 04:11 PM
dhruvi.patel
Help!?
There is an attachment already. I am a beginner and i have no idea what my professor is asking me for. Can someone please help me. Please look at the attachment.

Oh no! Disaster has struck some of company XYZ's redundant data centers. The administrators have managed to restore backups, but some data sets are still missing from some data centers. Fortunately, every data set can be found at least once in one or more of the data centers. However, before XYZ can resume normal operations, it needs to ensure that each data center has a copy of every data set. Your goal is to help XYZ resume normal operations by writing a program to synchronize data sets between data centers using as few copies as possible.
Input:
------
The first line of input will contain an integer between 0 and 999999 inclusive, representing the number of data centers. Following that will be one line of input for each data center. Each line will contain an integer representing the number of data sets at that data center, followed by a space and space-separated list of data set ids currently present at that data center. Data set ids are each an integer between 1 and 999999, inclusive. Each line will be at most 999 characters long. Data set ids are not necessarily consecutive. The list of data sets will not be in any particular order.
Output:
-------
The program must output an optimal data set copy strategy to ensure that every data center has a copy of every data set. Output one line for every copy instruction. A copy instruction is of the form <data-set-id> <from> <to>, where <data-set-id> is the data set id, <from> is the index of the data center the data set will be copied from (1 = the first data center), and <to> is the index of the data center to copy the data set to. When there are no more copy instructions, the program must output the word "done" on a line by itself.
There is often more than one correct output with minimal number of operations for a given input, and any output that satisfies the requirements is valid.
Constraints:
------------
The code you submit must take input from stdin and produce output to stdout as specified above. No other output is permitted. You can assume the input will be valid. In the examples below, the text
"Input:" and "Output:" (or "One Possible Correct Output:") are not part of the output, and neither are the blank lines.
• November 25th, 2013, 04:25 PM
GregBrannon
Re: Help!?
Quote:

i have no idea what my professor is asking me for.
Then you should ask your professor or the TAs for help.
• November 25th, 2013, 05:51 PM
TheoMuffin
Re: Help!?
I think what is asked for is straightforward. You just need to figure out how to implement what the professor is asking.
• November 27th, 2013, 07:40 PM
dhruvi.patel
Re: Help!?
Can someone atleast help me get started.