[Poi2011]Programming Contest

时间限制:10s      空间限制:128MB

题目描述

Bartie and his friends compete in the Team Programming Contest. There are n contestants on each team, and each team has access to n  computers. The contest lasts t minutes, during which the contestants are to solve m programming problems. Furthermore, penalties are imposed on the teams: solving a problem s minutes since the beginning of the contest amounts to  s penal points. The team that solved the most problems wins the contest, with ties broken in favour of the team with smaller penalty.
On the contest day Bartie quickly glances over the problem statements and distributes them among his teammates. He knows his team so well that he can exactly assess who is able to solve which problem. Solving any problem takes any contestant that is able to solve it exactly r minutes of using the computer.
Bartie's team did not fare well in this year's contest. Bartie is obsessed with the thought that it might be his fault, due to wrong decisions regarding the distribution of problems. He asks you to write a program that, given what Bartie knew at the beginning of the contest, determines the best possible result of Bytie's team, together with the assignment of problems to team members that attains the result.

n个人m个题目,每个题要r分钟完成。比赛有t分钟。给出每个人会做哪些题目,请你安排一个每个人在什么时候做什么题目,使得做出来的题目数最多。在做题数一样多的情况下,罚时尽量小。
 


输入格式

Five integers n,m,r,t and k(1<=n,m<=500,1<=r,t<=10^6)) are given in the first line of the standard input, separated by single spaces. These denote, respectively: the number of contestants on a team, the number of problems, the time it takes a contestant to solve a problem, the duration of the contest, and the number of contestant-problem pairs given on the input. Each of the following k lines holds two integers a and b(1<=a<=n,1<=b<=m)), separated by a single space, denoting that the contestant a is able to solve the problem b. Each such pair appears at most once in the input.
In tests worth at least 30% of the points it additionally holds that n,m<=100.


输出格式

In the first line of the standard output the best possible result of Bytie's team should be printed as two numbers separated by a single space: the number of solved problems z and the total penal points.


样例输入

2 4 3 15 4
1 1
2 3
1 4
1 3

样例输出

3 12

提示

没有写明提示


题目来源

没有写明来源

Menuappsclose