hust 1024 dance party

来源:互联网 发布:淘宝上有特色的礼物店 编辑:程序博客网 时间:2024/05/17 07:50

 

dance party

Time Limit: 2 Sec  Memory Limit: 128 MB
Submissions: 324  Solved: 112

Description

You are organizing a dance party. The party will be attended by n boys and n girls. There will be several rounds of dancing.
In each round, you divide the guests into n dancing pairs. Each guest must be in exactly one pair, and each pair must contain one boy and one girl. Each boy must dance with a different girl in every round. Some boys and girls like each other and some do not. During the party, each boy agrees to dance with at most k girls he doesn't like. Similarly, each girl agrees to dance with at most k boys she doesn't like. 
You are given the each pairs of boys and girls who agree to dance with each other .Find out the maximum number of rounds you can organize.

Input

The first line contains a integer t,which means there are t cases followed.
For each case,the first line contain three integer n,m,k ,which means there are n boys and n girls attending the party and m pairs of boys and girls who agree to dance with each other,and each boy or girl agrees to dance with at most k girls or boys he or she doesn't like.At last ,there are m lines with two integers a,b which means boy a and girl b agree to dance with each other.
(0<n<=100,0<m<=n*n,0<k<100,0<a,b<=n)

Output

The output cotains only one integer which means the maximum number of rounds you can organize.

Sample Input

22 4 01 12 22 11 23 7 01 11 21 32 12 23 13 3

Sample Output

22

HINT

 

Source

lshmouse

[Submit][Status][Discuss]

 


HOME Back

 

 

 

原创粉丝点击