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 | 3534 |

2 | moejy0viiiiiv | 3307 |

3 | ainta | 3174 |

4 | -XraY- | 3170 |

5 | LHiC | 3155 |

6 | Petr | 3135 |

7 | Um_nik | 3098 |

8 | Merkurev | 3055 |

9 | TakanashiRikka | 3031 |

10 | RomaWhite | 3007 |

# | User | Contrib. |
---|---|---|

1 | Errichto | 176 |

2 | rng_58 | 171 |

3 | Petr | 161 |

4 | csacademy | 155 |

5 | Swistakk | 152 |

6 | Zlobober | 148 |

7 | GlebsHP | 145 |

8 | zscoder | 137 |

8 | Um_nik | 137 |

10 | Xellos | 134 |

10 | Radewoosh | 134 |

10 | lewin | 134 |

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

↑

↓

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Apr/23/2017 18:49:46 (c4).

Desktop version, switch to mobile version.
User lists

Name |
---|

First, we suppose greedily that our dream team wins all of its missing matches. After this, it should have

Ppoints. Then, build a graph with nodesx_{1},x_{2}, ...,x_{n - 1}. Now, betweenx_{i}andx_{j}(i≠j), put an edge in each direction with capacity equal to the number of games missing between teamsiandj. Use a nodeB, which has an edge towards everyx_{i}with capacity equal to the number of matches thei^{th}team still has to play, and a nodeE, in such a way that there is an edge from eachx_{i}to this node with capacity equal toP-p_{i}, wherep_{i}are the points that thei^{th}team already has. Your dream team can be a champion iff the maxflow fromBtoEequals 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

Btox_{i}. 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 fromx_{i}tox_{j}means that teamilose to teamj. If no transfer occurs, theniandjdrew 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