Chef and IPC Certificates codechef November cook off challenge solution-
There were students (numbered through ) participating in the Indian Programming Camp (IPC) and they watched a total of lectures (numbered through ). For each student and each lecture , the -th student watched the -th lecture for minutes.
Additionally, for each student , we know that this student asked the question, "What is the criteria for getting a certificate?" times.
The criteria for getting a certificate is that a student must have watched at least minutes of lectures in total and they must have asked the question no more than times.
Find out how many participants are eligible for a certificate.
Input
- The first line of the input contains three space-separated integers , and .
- lines follow. For each valid , the -th of these lines contains space-separated integers .
Output
Print a single line containing one integer — the number of participants eligible for a certificate.
Constraints
- for each valid
- for each valid and
Example Input
4 8 4
1 2 1 2 5
3 5 1 3 4
1 2 4 5 11
1 1 1 3 12
Example Output
1
Explanation
- Participant watched minutes of lectures and asked the question times. Since , this participant does not receive a certificate.
- Participant watched minutes of lectures and asked the question times. Since and , this participant receives a certificate.
- Participant watched minutes of lectures and asked the question times. Since but , this participant does not receive a certificate.
- Participant watched minutes of lectures and asked the question times. Since and , this participant does not receive a certificate.
Only participant receives a certificate.
link -https://www.codechef.com/COOK124B/problems/IPCCERT
Must Join My telegram channel for more editorial post-
Solution -
this problem can be solved by using brute force approach .
Follow my code -
Comments
Post a Comment