#C10338. Medication Schedule Feasibility
Medication Schedule Feasibility
Medication Schedule Feasibility
You are given a schedule for taking medications. For each medication, you know its name, the number of times it needs to be taken, and the specific times (in 24-hour format) at which it should be taken. The schedule is considered feasible if no two medications are scheduled at the same time. In other words, for \( n \) medications with given times \( t_{i,j} \), the schedule is feasible if all these times are unique.
Note: The times are represented as integers (e.g. 8 for 8 AM, 20 for 8 PM) and can range from 0 to 23.
Your task is to check if the given medication schedule is feasible, i.e. there is no overlap between the timings of any two medications.
inputFormat
The input is read from stdin
and has the following format:
- The first line contains an integer \( n \) which denotes the number of medications.
- Each of the next \( n \) lines contains the description of a medication in the format:
medication_name k t_1 t_2 \dots t_k
Here, medication_name
is a string representing the name of the medication, k
is the number of times the medication is to be taken, and t_1, t_2, ..., t_k
are integers representing the time (in 24-hour format) at which the medication should be taken.
outputFormat
Output a single line to stdout
containing either Feasible
if the medication schedule has no overlapping times, or Not Feasible
if there is any overlap.
2
Aspirin 2 8 20
VitaminD 3 7 13 19
Feasible