UVa 119

From Algorithmist

Jump to: navigation, search

Contents

[edit] 119 - Greedy Gift Givers

[edit] Summary

A typical Simulation problem. Follow the instruction carefully.

[edit] Explanation

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

[edit] Gotcha's

Names should be printed in the order they appeared. Put one more line at the end will give your feedback as wrong answer (not presentation error as usual).

[edit] 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

[edit] Output

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

liz -3
steve -24
dave 27
Personal tools