HDU 5101 Select(BestCoder Round #17)

Problem Description:

One day, Dudu, the most clever boy, heard of ACM/ICPC, which is a very interesting game. He wants to take part in the game. But as we all know, you can‘t get good result without teammates.
So, he needs to select two classmates as his teammates. 
In this game, the IQ is very important, if you have low IQ you will WanTuo. Dudu‘s IQ is a given number k. We use an integer v[i] to represent the IQ of the ith classmate. 
The sum of new two teammates‘ IQ must more than Dudu‘s IQ.
For some reason, Dudu don‘t want the two teammates comes from the same class.
Now, give you the status of classes, can you tell Dudu how many ways there are.

Input:

There is a number T shows there are T test cases below. (T≤20)
For each test case , the first line contains two integers, n and k, which means the number of class and the IQ of Dudu. n ( 0≤n≤1000 ), k( 0≤k<231 ).
Then, there are n classes below, for each class, the first line contains an integer m, which means the number of the classmates in this class, and for next m lines, each line contains an integer v[i], which means there is a person whose iq is v[i] in this class. m( 0≤m≤100 ), v[i]( 0≤v[i]<231 )

Output:

For each test case, output a single integer.

Sample Input:

1

3 1

1 2

1 2

2 1 1

Sample Output:

5

时间: 2024-10-06 10:42:52

HDU 5101 Select(BestCoder Round #17)的相关文章

HDU 5167 Fibonacci(BestCoder Round #28)

Problem Description: Following is the recursive definition of Fibonacci sequence: Fi=???01Fi−1+Fi−2i = 0i = 1i > 1 Now we need to check whether a number can be expressed as the product of numbers in the Fibonacci sequence. Input: There is a number T 

HDU 5124 lines(BestCoder Round #20)

Problem Description: John has several lines. The lines are covered on the X axis. Let A is a point which is covered by the most lines. John wants to know how many lines cover A. Input: The first line contains a single integer T(1≤T≤100)(the data for 

HDU 4932 Miaomiao&#39;s Geometry(BestCoder Round #4)

Problem Description: There are N point on X-axis . Miaomiao would like to cover them ALL by using segments with same length. There are 2 limits: 1.A point is convered if there is a segments T , the point is the left end or the right end of T.2.The le

HDU 5101 Select(不同集合的两个数大于k的方案数)

Select Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1422    Accepted Submission(s): 395 Problem Description One day, Dudu, the most clever boy, heard of ACM/ICPC, which is a very interesting

HDU 5671 Matrix (BestCoder Round #81 (div.2) 1002)

传送门 Matrix Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 311    Accepted Submission(s): 142 Problem Description There is a matrix M that has n rows and m columns (1≤n≤1000,1≤m≤1000).Then we

HDU 5067 Harry And Dig Machine(BestCoder Round #14)

Problem Description: As we all know, Harry Porter learns magic at Hogwarts School. However, learning magical knowledge alone is insufficient to become a great magician. Sometimes, Harry also has to gain knowledge from other certain subjects, such as

HDU-5086-Revenge of Segment Tree (BestCoder Round #16)

Revenge of Segment Tree Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 205    Accepted Submission(s): 83 Problem Description In computer science, a segment tree is a tree data structure for st

HDU-5108-Alexandra and Prime Numbers (BestCoder Round #19)

Alexandra and Prime Numbers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 319    Accepted Submission(s): 120 Problem Description Alexandra has a little brother. He is new to programming. One

hdu5504 GT and sequence(BestCoder Round #60 )

GT and sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 334 Accepted Submission(s): 85 Problem Description You are given a sequence of N integers. You should choose some numbers(at least o