How can I solve the problem Hooligan?, problem H of the ACM-ICPC Latin American Contest 2009. Could anyone help me? http://coj.uci.cu/24h/problem.xhtml?pid=1210
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | jiangly | 3814 |
3 | jqdai0815 | 3682 |
4 | Benq | 3529 |
5 | orzdevinwang | 3526 |
6 | ksun48 | 3517 |
7 | Radewoosh | 3410 |
8 | hos.lyric | 3399 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 169 |
2 | maomao90 | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 161 |
5 | djm03178 | 158 |
6 | -is-this-fft- | 157 |
7 | adamant | 155 |
8 | awoo | 154 |
8 | Dominater069 | 154 |
10 | luogu_official | 150 |
How can I solve the problem Hooligan?, problem H of the ACM-ICPC Latin American Contest 2009. Could anyone help me? http://coj.uci.cu/24h/problem.xhtml?pid=1210
Name |
---|
First, we suppose greedily that our dream team wins all of its missing matches. After this, it should have P points. Then, build a graph with nodes x1, x2, ..., xn - 1. Now, between xi and xj (i ≠ j), put an edge in each direction with capacity equal to the number of games missing between teams i and j. Use a node B, which has an edge towards every xi with capacity equal to the number of matches the ith team still has to play, and a node E, in such a way that there is an edge from each xi to this node with capacity equal to P - pi, where pi are the points that the ith team already has. Your dream team can be a champion iff the maxflow from B to E equals the number of missing matches.
Do you consider whether the team wins, loses or draw?
Yes. I am considering that each team wins 1 point per every game that it has not played (This happens because every match distributes 2 points, so 1 per team). This amount of points is the flow from B to xi. After that, each team can "transfer" one point to other team, with the constraint that it cannot transfer more points than the matches that they can play between them. A point transfer from xi to xj means that team i lose to team j. If no transfer occurs, then i and j drew their game.
Thanks. Could you send me your code?
Sorry, I haven't coded it yet :/
This is a famous Max Flow problem, more info here