/
実行時間制限: 2 sec / メモリ制限: 1024 MiB
配点 : 233 点
問題文
高橋君は塾の講師として働いています。彼の仕事は、複数のクラスで実施したテストの結果を分析することです。
塾には N 個のクラスがあり、それぞれのクラスには 1 から N までの番号が付けられています。クラス i(1 \leq i \leq N)には M_i 人の生徒が在籍しており、その j 番目(1 \leq j \leq M_i)の生徒のテストの点数は S_{i,j} 点です。
高橋君は、各クラスについて「点数が基準点 K 点以上の生徒の人数」を求めたいと思っています。各クラス i について、テストの点数が K 点以上の生徒の人数 C_i を求めてください。
制約
- 1 \leq N \leq 10^5
- 0 \leq K \leq 100
- 1 \leq M_i \leq 100
- すべてのクラスの生徒数の合計は 10^6 以下、すなわち \sum_{i=1}^{N} M_i \leq 10^6
- 0 \leq S_{i,j} \leq 100
- 入力はすべて整数である
入力
N K
M_1 S_{1,1} S_{1,2} \ldots S_{1,M_1}
M_2 S_{2,1} S_{2,2} \ldots S_{2,M_2}
\vdots
M_N S_{N,1} S_{N,2} \ldots S_{N,M_N}
- 1 行目には、クラスの数 N と基準点 K がスペース区切りで与えられる。
- 続く N 行のうち i 行目には、クラス i の生徒数 M_i と、各生徒の点数 S_{i,1}, S_{i,2}, \ldots, S_{i,M_i} がスペース区切りで与えられる。
出力
C_1 C_2 \vdots C_N
- N 行にわたって出力する。
- i 行目には、クラス i において点数が K 点以上の生徒の人数 C_i を出力する。
入力例 1
3 60 5 45 72 60 88 55 3 100 59 60 4 30 40 50 20
出力例 1
3 2 0
入力例 2
5 75 6 80 65 90 75 70 85 4 74 75 76 100 3 50 60 70 8 75 75 75 75 74 74 74 74 2 0 100
出力例 2
4 3 0 4 1
入力例 3
10 50 10 45 55 60 40 70 80 35 50 65 48 8 100 99 98 97 96 95 94 93 5 0 25 50 75 100 12 10 20 30 40 50 60 70 80 90 100 49 51 3 50 50 50 7 49 49 49 49 49 49 49 6 51 52 53 54 55 56 4 0 0 0 0 9 100 100 100 100 100 100 100 100 100 15 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95
出力例 3
6 8 3 7 3 0 6 0 9 10
Score : 233 pts
Problem Statement
Takahashi works as an instructor at a cram school. His job is to analyze the results of tests administered across multiple classes.
The cram school has N classes, each numbered from 1 to N. Class i (1 \leq i \leq N) has M_i students enrolled, and the test score of the j-th student (1 \leq j \leq M_i) is S_{i,j} points.
Takahashi wants to determine, for each class, "the number of students whose score is at least the threshold score K." For each class i, find the number of students C_i whose test score is K points or higher.
Constraints
- 1 \leq N \leq 10^5
- 0 \leq K \leq 100
- 1 \leq M_i \leq 100
- The total number of students across all classes is at most 10^6, i.e., \sum_{i=1}^{N} M_i \leq 10^6
- 0 \leq S_{i,j} \leq 100
- All input values are integers
Input
N K
M_1 S_{1,1} S_{1,2} \ldots S_{1,M_1}
M_2 S_{2,1} S_{2,2} \ldots S_{2,M_2}
\vdots
M_N S_{N,1} S_{N,2} \ldots S_{N,M_N}
- The first line contains the number of classes N and the threshold score K, separated by a space.
- In the following N lines, the i-th line contains the number of students M_i in class i, followed by each student's score S_{i,1}, S_{i,2}, \ldots, S_{i,M_i}, separated by spaces.
Output
C_1 C_2 \vdots C_N
- Output N lines.
- The i-th line should contain C_i, the number of students in class i whose score is K points or higher.
Sample Input 1
3 60 5 45 72 60 88 55 3 100 59 60 4 30 40 50 20
Sample Output 1
3 2 0
Sample Input 2
5 75 6 80 65 90 75 70 85 4 74 75 76 100 3 50 60 70 8 75 75 75 75 74 74 74 74 2 0 100
Sample Output 2
4 3 0 4 1
Sample Input 3
10 50 10 45 55 60 40 70 80 35 50 65 48 8 100 99 98 97 96 95 94 93 5 0 25 50 75 100 12 10 20 30 40 50 60 70 80 90 100 49 51 3 50 50 50 7 49 49 49 49 49 49 49 6 51 52 53 54 55 56 4 0 0 0 0 9 100 100 100 100 100 100 100 100 100 15 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95
Sample Output 3
6 8 3 7 3 0 6 0 9 10