/
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 200 点
問題文
高橋君は学習塾の講師をしています。この塾では N クラスの生徒が模擬試験を受験しました。
各クラス i(1 \leq i \leq N)には A_i 人の生徒が所属しており、それぞれの生徒には試験の点数が記録されています。クラス i の j 番目(1 \leq j \leq A_i)の生徒の点数は B_{i,j} 点です。
高橋君は合格基準として合格ライン K 点を設定しました。点数が K 点以上の生徒を合格と判定します。
全てのクラスを通じて、合格と判定される生徒の総数を求めてください。
制約
- 1 \leq N \leq 10^5
- 0 \leq K \leq 100
- 1 \leq A_i \leq 100
- \sum_{i=1}^{N} A_i \leq 10^6(全クラスの生徒数の合計は 10^6 以下)
- 0 \leq B_{i,j} \leq 100
- 入力はすべて整数
入力
N K
A_1 B_{1,1} B_{1,2} \ldots B_{1,A_1}
A_2 B_{2,1} B_{2,2} \ldots B_{2,A_2}
\vdots
A_N B_{N,1} B_{N,2} \ldots B_{N,A_N}
- 1 行目には、クラスの数 N と合格ライン K がスペース区切りで与えられる。
- 第 i + 1 行(1 \leq i \leq N)には、クラス i に所属する生徒の人数 A_i と、そのクラスの各生徒の点数 B_{i,1}, B_{i,2}, \ldots, B_{i,A_i} がスペース区切りで与えられる。
出力
点数が K 点以上である生徒の総数を 1 行で出力せよ。
入力例 1
3 60 4 45 72 60 88 3 59 60 61 2 100 30
出力例 1
6
入力例 2
5 70 5 65 70 80 55 90 3 69 71 70 4 100 85 72 68 2 50 49 6 75 80 85 90 95 100
出力例 2
14
入力例 3
10 50 8 23 45 67 89 12 34 56 78 5 50 50 50 49 51 10 0 10 20 30 40 50 60 70 80 90 3 100 100 100 7 45 46 47 48 49 50 51 4 25 75 25 75 6 99 98 97 96 95 94 2 0 100 9 55 55 55 55 55 44 44 44 44 5 1 2 3 4 5
出力例 3
32
Score : 200 pts
Problem Statement
Takahashi is a lecturer at a cram school. At this school, students from N classes took a mock exam.
Each class i (1 \leq i \leq N) has A_i students, and each student's exam score has been recorded. The score of the j-th student (1 \leq j \leq A_i) in class i is B_{i,j} points.
Takahashi set a passing score of K points as the passing criterion. A student whose score is K points or higher is judged as passing.
Find the total number of students judged as passing across all classes.
Constraints
- 1 \leq N \leq 10^5
- 0 \leq K \leq 100
- 1 \leq A_i \leq 100
- \sum_{i=1}^{N} A_i \leq 10^6 (the total number of students across all classes is at most 10^6)
- 0 \leq B_{i,j} \leq 100
- All input values are integers
Input
N K
A_1 B_{1,1} B_{1,2} \ldots B_{1,A_1}
A_2 B_{2,1} B_{2,2} \ldots B_{2,A_2}
\vdots
A_N B_{N,1} B_{N,2} \ldots B_{N,A_N}
- The first line contains the number of classes N and the passing score K, separated by a space.
- The (i + 1)-th line (1 \leq i \leq N) contains the number of students A_i in class i, followed by the scores B_{i,1}, B_{i,2}, \ldots, B_{i,A_i} of each student in that class, separated by spaces.
Output
Print the total number of students whose score is K points or higher, on a single line.
Sample Input 1
3 60 4 45 72 60 88 3 59 60 61 2 100 30
Sample Output 1
6
Sample Input 2
5 70 5 65 70 80 55 90 3 69 71 70 4 100 85 72 68 2 50 49 6 75 80 85 90 95 100
Sample Output 2
14
Sample Input 3
10 50 8 23 45 67 89 12 34 56 78 5 50 50 50 49 51 10 0 10 20 30 40 50 60 70 80 90 3 100 100 100 7 45 46 47 48 49 50 51 4 25 75 25 75 6 99 98 97 96 95 94 2 0 100 9 55 55 55 55 55 44 44 44 44 5 1 2 3 4 5
Sample Output 3
32