Splitting the Bill (money)

25 teams scored 1920 points on this task, for a maximum score of 100, an average score of 77 and a median score of 100.

Highlights

  1. Liceo Scientifico N. Copernico, Udine is the institute with the most points (165).
  2. Lombardia is the region with the most points (315).

Statement

Giorgio and his friends like going out to have dinner a lot. Being a big group of N friends, including Giorgio, they always call in advance to book a table. However, every time they have to split the bill they don't know how to do it, since all of them only have credit cards! This means that there is always someone that pays the dinner for everybody, lending money to the others. Giorgio and his friends would like to make things even. They recorded M lendings of money, the i-th of which being A_i lending W_i euros to B_i. They need to decide which money transfers each of them needs to do, without making too many of them. In particular they want to make at most N-1 money transfer in total. Can you help Giorgio and his friends find which money transfers need to be done?