102282: [AtCoder]ABC228 C - Final Day

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $300$ points

Problem Statement

$N$ students are taking a $4$-day exam.

There is a $300$-point test on each day, for a total of $1200$ points.

The first three days of the exam are already over, and the fourth day is now about to begin. The $i$-th student $(1 \leq i \leq N)$ got $P_{i, j}$ points on the $j$-th day $(1 \leq j \leq 3)$.

For each student, determine whether it is possible that he/she is ranked in the top $K$ after the fourth day.
Here, the rank of a student after the fourth day is defined as the number of students whose total scores over the four days are higher than that of the student, plus $1$.

Constraints

  • $1 \leq K \leq N \leq 10^5$
  • $0 \leq P_{i, j} \leq 300 \, (1 \leq i \leq N, 1 \leq j \leq 3)$
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

$N$ $K$
$P_{1,1}$ $P_{1,2}$ $P_{1,3}$
$\vdots$
$P_{N,1}$ $P_{N,2}$ $P_{N,3}$

Output

Print $N$ lines. The $i$-th line $(1 \leq i \leq N)$ should contain Yes if it is possible that the $i$-th student is ranked in the top $K$ after the fourth day, and No otherwise.


Sample Input 1

3 1
178 205 132
112 220 96
36 64 20

Sample Output 1

Yes
Yes
No

If every student scores $100$ on the fourth day, the $1$-st student will rank $1$-st.
If the $2$-nd student scores $100$ and the other students score $0$ on the fourth day, the $2$-nd student will rank $1$-st.
The $3$-rd student will never rank $1$-st.


Sample Input 2

2 1
300 300 300
200 200 200

Sample Output 2

Yes
Yes

Sample Input 3

4 2
127 235 78
192 134 298
28 56 42
96 120 250

Sample Output 3

Yes
Yes
No
Yes

Input

题意翻译

有 $n$ 名学生要考 $4$ 天试,每天的试验的满分都是 $300$ 分,所以这四天的试验的满分就是 $1200$ 分。现在前三天的考试已经结束,并且知道第 $i$ 名学生在第 $j$ 天拿到了 $p_{i,j}$ 分。对于每个学生,问:在第四天的考试中,该生的排名是否有可能进入总排名的前 $k$ 位以内?如果是,输出`Yes`;否则输出`No`。 (注)排名计算方法:若有 $x$ 个人比第 $i$ 名学生的总分高,则第 $i$ 名学生的排名为第 $(x+1)$ 名。

Output

分数:$300$分

问题描述

$N$名学生正在参加一个为期$4$天的考试。

每天都有一个$300$分的测试,总共有$1200$分。

考试的前三天已经结束,第四天马上就要开始了。第$i$名学生$(1 \leq i \leq N)$在第$j$天$(1 \leq j \leq 3)$得到了$P_{i, j}$分。

对于每个学生,确定是否有可能在他/她在第四天后排名前$K$。

在这里,学生在第四天后的排名定义为在四天内总分高于该学生的人数加$1$。

约束

  • $1 \leq K \leq N \leq 10^5$
  • $0 \leq P_{i, j} \leq 300 \, (1 \leq i \leq N, 1 \leq j \leq 3)$
  • 输入中的所有值都是整数。

输入

输入从标准输入按以下格式给出:

$N$ $K$
$P_{1,1}$ $P_{1,2}$ $P_{1,3}$
$\vdots$
$P_{N,1}$ $P_{N,2}$ $P_{N,3}$

输出

打印$N$行。第$i$行$(1 \leq i \leq N)$应该包含Yes,如果第$i$名学生有可能在第四天后排名前$K$,否则打印No


样例输入1

3 1
178 205 132
112 220 96
36 64 20

样例输出1

Yes
Yes
No

如果每个学生在第四天得$100$分,那么第$1$名学生将排名$1$。

如果第$2$名学生得$100$分,其他学生得$0$分,那么第$2$名学生将排名$1$。

第$3$名学生永远不会排名$1$。


样例输入2

2 1
300 300 300
200 200 200

样例输出2

Yes
Yes

样例输入3

4 2
127 235 78
192 134 298
28 56 42
96 120 250

样例输出3

Yes
Yes
No
Yes

加入题单

算法标签: