CSPC '15 #4 - Reading Logs

View as PDF

Submit solution

Points: 5
Time limit: 1.0s
Memory limit: 64M

Author:
Problem type

Over the break, a group of Crescent students are assigned to read a book by their English teacher Mr. Johnson. Different students, of course, have different reading speeds for whatever reason, be it ability or laziness. Mr. Johnson, however, does not hold the traditional view that the fastest reader is the best, simply because he will forget the entire book after not having touched it for days.

In his mind, the perfectly efficient readers are the ones who finish the book by reading the least number of pages per day. If a book can be finished on time but with fewer pages read per day, the reader is not perfectly efficient. The perfectly efficient readers are the most efficient. So, he set up an online form which asks the student to report how many pages they read daily. Sadly, he mailed it to the wrong mailing list, and as a result, students from other classes responded. Luckily, the form did ask for the class number.

Not being the best person to do programming, Mr. Johnson has reached out to you to write a program which would find the most efficient readers.

Note: If the pages don't divide evenly in the days, round the number to a whole number: Round(pagesLeft / daysLeft).

Input Specification

  • First line, the integer D (0 \le D \le 100), specifying the days left in the break.
  • Second line, the integer P (0 \le P \le 100), the number of pages in the book.
  • Third line, the class code as a string.
  • Fourth line, the integer N (0 \le N \le 100), the number of students in the class.
  • The next N lines, the i^\text{th} line containing the i^\text{th} student's name, the daily number of pages read P_i (0 \le P_i \le 100), and the class code.

Output Specification

If there is one most efficient reader, output The most efficient reader is NAME. Otherwise, output The most efficient readers are NAME,NAME,NAME., in the order listed in the input.

Then, if the reader(s) is/are perfectly efficient, output This reader is perfectly efficient. or These readers are perfectly efficient., depending on the number of most efficient readers. Otherwise, output None of the readers are perfectly efficient.

Sample Input

5
50
ENG1D-2
3
Gorav 20 ENG1D-2
Adrian 10 ENG1D-2
Jack 50 ENG1D-1

Sample Output

The most efficient reader is Adrian.
This reader is perfectly efficient.

Comments

There are no comments at the moment.