Internationali­zation Puzzles

24/5 support

TOPlap is expanding internationally. In 2022 a branch office opened in Melbourne, Australia. Together with offices in Delft, Manchester, Saõ Paulo and Orlando, customer support can provide service across many time zones. In fact, with the opening of the Melbourne office, it becomes feasible to offer 24/5 support.

You are given the following assignment: investigate how 24/5 support can be offered worldwide from five TOPlap offices, while minimizing overtime.

24/5 support is simple in theory: customers anywhere in the world can call support during working days, from midnight on Monday morning to midnight on Friday evening. Of course this immediately raises the question: midnight in which time zone? To keep it simple for customers, TOPlap gives them support from 00:00 monday to 24:00 friday in their own time zone. How will this policy affect the working hours of customer support employees?

Regular working hours for TOPlap employees are from Monday to Friday, from 08:30 to 17:00, excluding public holidays. Outside this service window, support can still be offered, but should be minimized due to extra costs, both in terms of overtime pay and in terms of work-life balance for employees.

Let's take a look at an ordinary Monday in 2022:

In this diagram, the normal working hours of the five customer support offices are indicated with an 'S'. Individual customers can request support in timeslots marked with an 'R'. They are entitled to support from Monday 0:00, up to Friday at 24:00 in their own local time.

Monday                  Hour (UTC): 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 1 1 1 1 1 2 2 2 2 
11 April 2022                                           0 1 2 3 4 5 6 7 8 9 0 1 2 3 
                                    | | | | | | | | | | | | | | | | | | | | | | | | 
                          Melbourne SSSSSSSSSSSSSS                               SSS
                              Delft              SSSSSSSSSSSSSSSSS                  
                         Manchester                SSSSSSSSSSSSSSSSS                
                          São Paulo                        SSSSSSSSSSSSSSSSS        
                            Orlando                          SSSSSSSSSSSSSSSSS      
                                    | | | | | | | | | | | | | | | | | | | | | | | | 
                 FaxSchool, Halifax       RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
   El Universidad Libre de Santiago         RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
                   Tokyo Media Corp RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR

The diagram starts at the left at 0:00 (midnight) UTC. Australia, always first to greet the sun from the east, is already wide awake by then. They cover support from the Melbourne office until 7:00 UTC. By then Delft has already warmed up, because they started at 6:30 UTC. During the remainder of the day, Manchester, São Paulo and then Orlando come in to the mix as well. But, there is a period of 90 minutes, between 21:00 and 22:30 UTC, where there is no support available, at least not within standard working hours. During this period, TOPlap will have to pay overtime somewhere, and ask some staff to come in earlier or later than normal. (For the purposes of your assignment, it does not matter which office takes on the overtime burden).

On this ordinary Monday, TOPlap will have to pay for 90 minutes of overtime. This calculation is the same regardless which customer you are supporting.

By the end of the year, things have shifted around a bit, due to daylight saving time. Take for example Friday 9 December:

Friday                  Hour (UTC): 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 1 1 1 1 1 2 2 2 2 
09 December 2022                                        0 1 2 3 4 5 6 7 8 9 0 1 2 3 
                                    | | | | | | | | | | | | | | | | | | | | | | | | 
                          Melbourne SSSSSSSSSSSS                                    
                              Delft                SSSSSSSSSSSSSSSSS                
                         Manchester                  SSSSSSSSSSSSSSSSS              
                          São Paulo                        SSSSSSSSSSSSSSSSS        
                            Orlando                            SSSSSSSSSSSSSSSSS    
                                    | | | | | | | | | | | | | | | | | | | | | | | | 
                 FaxSchool, Halifax RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
   El Universidad Libre de Santiago RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
                   Tokyo Media Corp RRRRRRRRRRRRRRRRRRRRRRRRRRRRRR                  

As you can see, now there is a period of 90 minutes, between 6:00 and 7:30 UTC, when there is no support available during standard working hours. Additionally, there is a period of 120 minutes after 22:00 UTC when Orlando is closing to celebrate weekend, while some customers are still expecting support.

On this Friday in December, TOPlap will have to shell up for 210 minutes of overtime. But if you look more closely, you can see that the calculation depends on which customer you are supporting. Some customers require more overtime reservation than others.

Things are complicated somewhat during holidays. Take for example 18 April 2022, the Monday after Easter. On this day, supporters from the Melbourne office have a day off. This leaves a gap in support that needs to be covered with overtime. However, there is a saving grace: customers from the 'Universidad Libre de Santiago' have a day off on Easter Monday too, and do not need support. On holidays which the customer observes, you won't receive calls from them, and you won't need to make overtime reservations for them either.

Monday                  Hour (UTC): 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 1 1 1 1 1 2 2 2 2 
18 April 2022                                           0 1 2 3 4 5 6 7 8 9 0 1 2 3 
                                    | | | | | | | | | | | | | | | | | | | | | | | | 
                          Melbourne                                              SSS
                              Delft              SSSSSSSSSSSSSSSSS                  
                         Manchester                SSSSSSSSSSSSSSSSS                
                          São Paulo                        SSSSSSSSSSSSSSSSS        
                            Orlando                          SSSSSSSSSSSSSSSSS      
                                    | | | | | | | | | | | | | | | | | | | | | | | | 
                 FaxSchool, Halifax       RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
   El Universidad Libre de Santiago                                                 
                   Tokyo Media Corp RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR

On 18 April, TOPlap will have to reserve overtime as follows:

Your puzzle input contains two sections. The first section is a list of support offices, the time zone where they are located, and a list of public holidays that they observe. The second section contains a list of customer companies, their time zones, and their public holidays.

Here is your test input:

TOPlap office in Melbourne	Australia/Melbourne	26 December 2022;15 April 2022;18 April 2022;26 January 2022
TOPlap office in Delft	Europe/Amsterdam	6 June 2022;26 December 2022;26 May 2022;27 April 2022
TOPlap office in Manchester	Europe/London	26 December 2022;15 April 2022;3 June 2022
TOPlap office in São Paulo	America/Sao_Paulo	28 February 2022;26 December 2022;15 April 2022;1 May 2022
TOPlap office in Orlando	America/New_York	17 January 2022;26 December 2022;4 July 2022;5 September 2022

FaxSchool, Halifax	America/Halifax	6 January 2022;3 January 2022
El Universidad Libre de Santiago	America/Santiago	3 January 2022;18 April 2022
Tokyo Media Corp	Asia/Tokyo	15 April 2022;26 May 2022

If we work through the year 2022 (we start at 0:00 UTC on Jan 1 2022, up to 24:00 UTC on Dec 31 2022), then we get:

Your final result is the difference between the highest and the lowest amounts of overtime, in this case: 44760-41730 = 3030 minutes.

What is, in the year 2022, the difference between highest and lowest amount of overtime per customer for your puzzle input?

To play, please log in with one of these options:
GitHub Login | Google Login