Problem C
Simple Cron Spec
A Cron Spec is used by Linux to specify when to repeatedly execute a certain job. For this problem, consider a Simple Cron Spec that defines when a job needs to be run within a single day. A Simple Cron Spec has three space separated tokens:
that specify at which hours/minutes/seconds a job will be
run. Hour values are
Each token consists of a single integer value, a value range (two values separated by a dash ‘-’), a comma-separated list of multiple values and/or value ranges, or an asterisk (‘*’). A value range represents all integer values between the low and high value, inclusive. An asterisk is a special token that represents all possible values. The specified values in any comma separated list must be non-overlapping.
For example, the specification:
says the job will be run every hour, at minute
Given a list of Simple Cron Specs, determine two things: First, the number of seconds in the day that at least one job will start, and second, the total number of job starts during the day. Note that if a single job starts 24 times in a day, that counts as 24 job starts.
Input
The first line of input contains a single integer
Each of the next
Output
Output two space separated integers. The first is the number
of seconds in the
Sample Input 1 | Sample Output 1 |
---|---|
2 * 30 20,25,30-33 9,15 30 * |
252 264 |