Think I'll Buy Me a Football Team (UVa Live Archive Africa and the Middle East - Africa and Arab - 2008/2009 Alexandria - Egypt)

http://acmicpc-live-archive.uva.es/nuevoportal/data/problem.php?p=4367

問題

銀行の貸し借りのグラフが与えられる。それを簡約化するとグラフの辺の重みの合計はいくらになるか。
銀行の数<1000

解法

max(0, 頂点から出ている値の合計 ー 入ってくる値の合計)の総和を取れば良い。