UVA-10766Organising the organisation
Time Limit: 3000MS |
Memory Limit: Unknown |
64bit IO Format: %lld &%llu |
Submit Status Description Problem H Organising the organisation Input: Standard Input Output: Standard Output Time Limit: 2 Second I am the chief of the Personnel division of a moderate-sized company it wishes to remain anonymous, and I am currently F Acing a small problem for which I need a skilled programmer ' s help. Currently, we are divided to several more or less independent divisions. In order-to-make efficient, these need to be organised in a hierarchy, indicating which divisions is in Charge of other divisions. For instance, if there is four divisions a, B, C and D we could organise them as in Figure 1, with Division A controlling Divisions B and D, and Division D controlling Division C.
One of the divisions is central Management (Division A in the figure above), and should of course was at the top of the hierarchy, but the relative importance of the remaining divisions are not determined, so in Figure 1 above, Division C and D could equally well has switched places so that C is in charge over division D. One complication, however, is the it may are impossible to get some divisions to cooperate with each other, and in such a Case, neither of these divisions can is directly in charge of the other. For instance, if in the example above a and D were unable to cooperate, Figure 1 was not A valid a-to-organise the company . In general, there can of course was many different ways to organise the organisation, and thus it was desirable to find the Best one (for instance, it isn't a good idea to let the programming people being in charge of the marketing people). This job, however, is-on-the-too complicated for you, and your job are simply to help us find out how much to pay the Consulta NT that we hire to find the best organisation for us. In order to determine the consultant's pay, we need to find out exactly how difficult the task was, which is so you have t o count exactly how manydifferent ways there is to organise the organisation. Oh, and I need the answer in five hours. InputThe input consists of a series of test cases, at most -, terminated by End-of-file. Each test cases begins with three integersN, M, K (1≤n≤50, 0≤m≤1500, 1≤k≤n).NDenotes the number of divisions in the company (for convenience, the divisions is numbered from1ToN), andkIndicates which division is the central Management division. This was followed bymLines, each containing, integers1≤i, J≤n, indicating that divisionIand divisionJCannot cooperate (thus,ICannot is directly in charge ofJandJCannot is directly in charge ofI). Assume thatIandJis always different. OutputFor each test case, print the number of possible ways to organise the company on a line by itself. This number would be in least 1 and at the most 1015. Sample input Output for sample input
Problem Setter:per Austrin Source Root:: Prominent problemsetters:: Per Austrin Root:: AOAPC ii:beginning algorithm Contests (Second Edition) (Rujia Liu):: Chapter 12. Advanced Topics:: ExtraSubmit Status |
|