It's the end of the school year and a lot of your friends are having graduation parties. Unfortunately, five of your best friends all scheduled theirs around the same time on the same day! You like all of your friends equally so you want to attend each party for exactly the same amount of time. Based on the times of the parties and time it takes to travel between each party, what is the maximum amount of time you can spend at each party?
Details and Assumptions:
Party 1: 12pm - 4pm
Party 2: 3pm - 5pm
Party 3: 1pm - 5pm
Party 4: 12pm - 3pm
Party 5: 1pm - 3pm
You arrive at the first party at 12pm sharp.
The time it takes to travel between each party is 15 minutes times the difference between the two party numbers. For example, it takes only 15 minutes to get from Party 2 to Party 3, but it takes 45 minutes to get from Party 2 to Party 5. This formula can be written as for your convenience.
You're not allowed to wait for another party to start, you're only possible actions are "partying" and "traveling".