You are on page 1of 1

Coderun 04 - The Revival  

  Mar 14, 2023

Problem A. Student Got Certificates


Time limit 1000 ms
Code length Limit 50000 B
OS Linux

In the Indian Programming Camp (IPC), there were N students (numbered 1 to N) who watched K
lectures (numbered 1 to K). Each student i watched lecture j for Ti,j minutes. In addition, each

student i, asked the question "What are the criteria for getting a certificate?" Qi times.

To receive a certificate, a student must have watched a minimum of M minutes of lectures in


total and asked the question no more than 10 times. Determine the number of students who meet
these criteria and are eligible to receive a certificate.

Input

The first line of the input contains N , M and K .


Next N lines for each valid i, the i-th of these lines contains K + 1 space-separated
integers Ti,1 , Ti,2 , … , Ti,K , Qi .
​ ​ ​ ​

Output

Print the number of participants eligible for a certificate.

Constraints

1 ≤ N, K ≤ 1, 000
1 ≤ M ≤ 106
1 ≤ Qi ≤ 106 for each valid i

1 ≤ Ti,j ≤ 1, 000 for each valid i and j


Sample 1
Input Output
3 8 4 1
1 4 2 6 11
2 4 5 3 6
1 2 2 2 3

For 1st participant 1 + 4 + 2 + 6 = 13 but number of questions asked are 11 > 10. So, doesn't
get certificate.
For 2nt participant 2 + 4 + 5 + 3 = 14 and number of questions asked are 6 < 10. So, get
certificate.
For 3rd participant 1 + 2 + 2 + 2 = 7 which is < 8. So, doesn't get certificate.

You might also like