Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Language: System Test
Description A semi-final competition was just over. There are n players. Each player had an SEED number from 1 to n. The competition had m problems in coding phase and challenge phase. The final rank was decided by the total score of the m problems and challenge scores. The higher the total score was, the higher a player ranked. If two players got the same total score, the one with the smaller SEED number got a higher rank. We know that for each problem, how much score each player might get if his solution is correct (if not, the player got 0 in the problem). And we also know how much score each player get during the challenge phase. After the system-tests, the c1 highest ranked players will advance to the final round, the next c2 highest scoring players will advanced to wildcard round. Before the system-tests, you need to count how many different combinations of advancers (including finalist and wildcard participants) are possible. Two ranks with same set of finalist and wildcard participants are consider same here. Note that, the players with negative scores can also advance to the final round or wildcard round, because the challenge scores may be smaller than 0. Input The first line of input four integers n, m, c1, c2, denote the number of players, the number of problems, the number of finalist and the number of player will advanced to wildcard round. 3 ≤ n ≤ 40, 1 ≤ m ≤ 40, c1 ≥ 1, c2 ≥ 1, n-c1-c2 ≥ 1 Output The first line of output contains one integer denoting the number of different advancers. Sample Input Sample Input 1 3 1 1 1 1 10 0 2 10 0 3 10 0 Sample Input 2 6 1 2 2 1 10 0 2 10 0 3 10 0 4 10 0 5 10 0 6 10 0 Sample Output Sample Output 1 5 Sample Output 2 43 Source POJ Founder Monthly Contest – 2008.10.05, Lou Tiancheng |
[Submit] [Go Back] [Status] [Discuss]
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator