atcoder#ABC228C. [ABC228C] Final Day
[ABC228C] Final Day
Score : points
Problem Statement
students are taking a -day exam.
There is a -point test on each day, for a total of points.
The first three days of the exam are already over, and the fourth day is now about to begin. The -th student got points on the -th day .
For each student, determine whether it is possible that he/she is ranked in the top 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 .
Constraints
- $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:
Output
Print lines. The -th line should contain Yes
if it is possible that the -th student is ranked in the top after the fourth day, and No
otherwise.
3 1
178 205 132
112 220 96
36 64 20
Yes
Yes
No
If every student scores on the fourth day, the -st student will rank -st. If the -nd student scores and the other students score on the fourth day, the -nd student will rank -st. The -rd student will never rank -st.
2 1
300 300 300
200 200 200
Yes
Yes
4 2
127 235 78
192 134 298
28 56 42
96 120 250
Yes
Yes
No
Yes