UVa 119 - Greedy Gift Givers

119 - Greedy Gift Givers

 * http://acm.uva.es/p/v1/119.html

Summary
A typical Simulation problem. Follow the instruction carefully.

Explanation
N can be at most 10, so the naive array implementation will do.

Gotcha's
Names should be printed in the order they appeared.

Input
5 dave laura owen vick amr dave 200 3 laura owen vick owen 500 1 dave amr 150 2 vick owen laura 0 2 amr vick vick 0 0 3 liz steve dave liz 30 1 steve steve 55 2 liz dave dave 0 2 steve liz

Output
dave 302 laura 66 owen -359 vick 141 amr -150

liz -3 steve -24 dave 27