Intergalactic Team

시간 제한3초메모리 제한2048 MB

요약
모든 팀원이 서로를 원하고 서로를 원하는 쌍은 함께 뽑히거나 함께 빠지는 조건으로 정확히 k명을 뽑는 경우의 수를 구한다.
난이도

보통10점 중 5점

유형
그래프, 조합론, 유니온 파인드, 수학
정답자
아직 제출이 없습니다

문제

The Intergalactic Competitive Programming Contest (ICPC) is coming up, and it’s time to choose a team that will represent our planet in this esteemed competition. The ICPC president has announced the team size for this year’s competition to all planets that want to compete. The Earth ICPC committee needs to form a team that consists of exactly this number of members.

To maximize compatibility and teamwork between team members, a set of people can form a team if for any pair of members (u,v)(u, v) in the set, uu must specify vv as someone they want to work with and vice versa. In addition, as part of the competitors’ demand, if two competitors specify that they want to work with each other, then either both of them or neither of them shall be in the team.

Earth has nn eligible competitors to participate in this year’s competition. Earth has collected data regarding for every competitor who they want to work with as teammates. With this information available, can you help the Earth ICPC committee determine the number of ways to choose a team of the required size for the upcoming competition? Two team configurations are considered different if there is at least one member that is in one configuration but not in the other.

입력

The first line of input contains three integers nn, mm, and kk (1≤n≤1051 ≤ n ≤ 10^5, 1≤m≤min⁡(n⋅(n−1),106)1 ≤ m ≤ \min(n \cdot (n - 1), 10^6), 1≤k≤n1 ≤ k ≤ n), where nn is the number of prospective competitors, mm is the number of entries specifying that which competitors are willing to work with which competitors, and k is the exact team size required for this year’s ICPC.

The competitors are numbered 11 to nn. The next mm lines each contain two integers xx and yy (1≤x,y≤n1 ≤ x, y ≤ n, x≠yx \ne y), denoting that competitor xx wants to work with competitor yy. It is guaranteed that all those entries are unique.

출력

Output a single integer, the number of ways for the Earth ICPC committee to choose a team for the upcoming ICPC.

예제1

  1. 예제 1

    입력
    7 7 2
    1 2
    2 3
    3 1
    4 5
    5 4
    6 7
    7 6
    
    예상 출력
    2