Completion of the project and executing it in c++ -- 2

Completed Posted 7 years ago Paid on delivery
Completed Paid on delivery

Gift Swapathon

Problem statement:

You are given the numbers of gifts each child is swapping and, for each child, a ranked list of the M gifts to be swapped. The rankings range from 1 to M, with lower numbers representing higher preference. You must assign the gifts to the children such that you minimize the sum of the rankings for the assigned gifts (per the receiving child), subject to the following constraints: 1. Each gift must be assigned to exactly one child. 2. Each child must be assigned the same number of gifts they donate to the swapathon. 3. No child can be assigned a gift such that their ranking is greater than 0.75 * M.

Important: the sum of the rankings should be the lowest value that is possible for the given input file.

Input format:

Plain text tab-delimited file with N + 1 rows, where N = number of children, and M + 2 columns, where M = total number of gifts to be swapped. The first row will be a header row including gift IDs and the first column will be a header column including each child’s ID. The second column will contain the number of gifts the given child is contributing. Each entry will have exactly one string (with no white space). Each row contains a ranking of the child’s preference, where 1 indicates highest preference and M indicates lowest. (Each rank is represented and no ties are allowed.) An example follows:

Child num g1 g2 g3 g4 g5 C1 2 5 3 2 4 1 C2 1 5 1 4 2 3 C3 2 1 4 2 3 5

Output format:

The output should be a plain text tab-delimited file. It should begin with ‘AllScores=x’, where x is the sum of the preference rankings for the assigned gifts. This should be followed by N + 1 rows, each consisting of M + 2 columns. The first row should be a header row with the gift IDs, in the same order as the input file. The first two columns should consist of each child’s ID and number of gifts contributed, in the same order as the input file. All other entries should be zero, unless the particular gift is assigned to the given child. In this case, the child’s preference rating for the gift should be given instead of zero. An example follows:

AllScores=8 Child num g1 g2 g3 g4 g5 C1 2 0 0 2 0 1 C2 1 0 1 0 0 0 C3 2 1 0 0 3 0

This output indicates that C1 will be given g3 and g5, C2 will be given g2, and C3 will be given g1 and g4. Note that the number of gifts donated by the given child must match the number of non-zero entries in the remainder of the row. Also, there should be exactly one non-zero entry in each gift column. Finally, the sum of the entries for all gift columns should be equal to the ‘AllScores’ value given on the first line of the output.

C++ Programming

Project ID: #12249439

About the project

5 proposals Remote project Active 7 years ago

Awarded to:

mebur

I am newer for freelancer.com but i have a lot of experience about C++ and programming. I can easily solve your problem.

$30 USD in 2 days
(4 Reviews)
2.3

5 freelancers are bidding on average $36 for this job

hbxfnzwpf

I am very proficient in c and c++. I have 16 years c++ developing experience now, and have worked for more than 6 years. My work is online game developing, and mainly focus on server side, using c++ under linux environ More

$80 USD in 1 day
(125 Reviews)
6.8