Back
Close

Mrs. Knuth - Part II

Statement

 Goal

This puzzle is part 2 of a multi-part Algorithm X tutorial and is meant to be done per the guidance in the following playground:

https://www.algorithm-x.com

You are free to solve this puzzle in any language you choose. While the playground demonstrations are written in Python, a reusable Algorithm X Solver is available in many different languages. By following the guidance in the playground and using the solver as intended, this puzzle should be much easier than attempting it from scratch.

Task Overview:

Mrs. Knuth was thrilled with the work you did for her in Part I and her scheduling has been a breeze! She did run into a couple of issues though, and she'd like you to integrate the following changes into your scheduling algorithm.

Mrs. Knuth's schedule needs to be more flexible than she first thought. She isn't able to always teach the same number of hours on her teaching days. She also doesn't always have enough students to completely fill her teacherAvailability. You'll need to adjust your algorithm to handle her teacherAvailability possibly containing different numbers of hours for each day she teaches and you'll need to be able to handle hours in her teacherAvailability for which there ends up being no student scheduled.

You might be impressed with Mrs. Knuth's newfound flexibility, but don't get too relaxed. She still requires that no instrument be taught more than one hour on any one day. On top of that, she has struggled with loudInstruments, specifically the Trumpet, the Drums and the Trombone. In the interest of her long-term hearing, she has asked that you make sure no two loudInstruments are ever scheduled back-to-back. (A lesson at 11am and a lesson at 1pm are not considered back-to-back since there is an hour lunch break between the two.)

For the most part, the kids in school are good kids, but some kids get a bit rowdy when they are with certain friends. To avoid disruptions to her schedule, Mrs. Knuth has given you a list of troublesomePairs. It's important the individuals in these pairs never be scheduled back-to-back. There must be at least an hour of time between the two individuals to ensure they don't get each other wound up and start causing trouble.

Despite Mrs. Knuth's wacky requests, all students must get a spot on her schedule.

All notes about INPUT and OUTPUT formatting still apply to Part II. For your reference, those notes have been copied here:

Note About INPUT Formatting:

Availability for Mrs. Knuth, or for any one student, is formatted as a character string using the following abbreviations for the days of the week: M, Tu, W, Th and F. An availabilityString will contain all 5 abbreviations in this same order. After each abbreviation will be between 0 and 8 integers representing the times the person is available on that day. Lessons can be taught in the morning at 8, 9, 10 and 11 and in the afternoon at 1, 2, 3 and 4. Consider the following availabilityString:

M 1 2 3 Tu W Th 8 9 F 11

This indicates the person is available on Monday at 1pm, 2pm and 3pm, on Thursday at 8am and 9am and on Friday at 11am. This person has no availability on Tuesday or Wednesday.

The only valid elements in an availabilityString are M, Tu, W, Th, F, 8, 9, 10, 11, 1, 2, 3 and 4. All elements of an availabilityString are space separated.

Note About OUTPUT Formatting:

Mrs. Knuth requires a very specific format for her calendar. Her calendar has 10 rows and 6 columns with one space between each of the 6 columns.

Column 1 is 2 characters wide. In it, rows 2 – 5 and 7 – 10 contain the hours of the days, right justified. See the example below.

Columns 2 – 6 are each 14 characters wide. The contents of each row in each column is always center justified, with the extra space being on the right when it is not possible to perfectly center justify the text. At the top of each column is the day, fully written out as Monday, Tuesday, Wednesday, Thursday or Friday. In the 6th row of columns 2 - 6 is the word LUNCH.

The remainder of columns 2 – 6 contain Mrs. Knuth’s teaching schedule. If no student is scheduled on a particular day at a particular hour, the schedule should contain 14 dashes (--------------). Wherever a student has been scheduled, the location should contain the student’s name and the student’s instrument separated by a /.

All lines of the schedule must have trailing spaces removed.
Input
Line 1: Mrs. Knuth’s teacherAvailability

Line 2: An integer numStudents

Next numStudents lines: name instrument studentAvailability

Next Line: An integer numTroublesomePairs

Next numTroublesomePairs lines: name1 name2
Output
10 lines: schedule per the rules above. Trailing spaces must be removed from each line.
Constraints
• 2 <= length of name <= 4.

• 4 <= length of instrument <= 9.

• The only loudInstruments are Trumpet, Drums and Trombone.

• numStudents <= Mrs. Knuth's available hours per week.

• 1 <= numTroublesomePairs <= 12.

• The two names in a troublesomePair are always different.

• All students have unique names.

• name and instrument do not contain any spaces.

• teacherAvailability and studentAvailability are in the availabilityString format as explained in Goal section and always valid (e.g. no duplicate hours on the same day).

• All lessons consist of 1 student with 1 instrument for 1 hour.

• Mrs. Knuth will be available to teach on at least 1 day and at most 5 days.

• All test cases have a unique solution.
Example
Input
M Tu W Th F 8 9 10 11 1
3
Drew Trombone M Tu W Th F 10 11 1
Ella Flute M Tu W Th F 10 1
Lola Drums M Tu W Th F 11 1
1
Drew Ella
Output
       Monday        Tuesday       Wednesday       Thursday        Friday
 8 -------------- -------------- -------------- -------------- --------------
 9 -------------- -------------- -------------- -------------- --------------
10 -------------- -------------- -------------- --------------   Ella/Flute
11 -------------- -------------- -------------- --------------   Lola/Drums
       LUNCH          LUNCH          LUNCH          LUNCH          LUNCH
 1 -------------- -------------- -------------- -------------- Drew/Trombone
 2 -------------- -------------- -------------- -------------- --------------
 3 -------------- -------------- -------------- -------------- --------------
 4 -------------- -------------- -------------- -------------- --------------

Tags
Algorithm XExact CoverBacktracking

Difficulty
Medium

Test cases
Basic Test
Input
M Tu W Th F 8 9 10 11 1 3 Drew Trombone M Tu W Th F 10 11 1 Ella Flute M Tu W Th F 10 1 Lola Drums M Tu W Th F 11 1 1 Drew Ella
Output
Monday Tuesday Wednesday Thursday Friday 8 -------------- -------------- -------------- -------------- -------------- 9 -------------- -------------- -------------- -------------- -------------- 10 -------------- -------------- -------------- -------------- Ella/Flute 11 -------------- -------------- -------------- -------------- Lola/Drums LUNCH LUNCH LUNCH LUNCH LUNCH 1 -------------- -------------- -------------- -------------- Drew/Trombone 2 -------------- -------------- -------------- -------------- -------------- 3 -------------- -------------- -------------- -------------- -------------- 4 -------------- -------------- -------------- -------------- --------------

Validator 1 Validator
Input
M Tu W Th 2 3 4 F 2 Josh Drums M Tu W Th 2 3 4 F Liam Trumpet M Tu W Th 2 3 F 1 Josh Liam
Output
Monday Tuesday Wednesday Thursday Friday 8 -------------- -------------- -------------- -------------- -------------- 9 -------------- -------------- -------------- -------------- -------------- 10 -------------- -------------- -------------- -------------- -------------- 11 -------------- -------------- -------------- -------------- -------------- LUNCH LUNCH LUNCH LUNCH LUNCH 1 -------------- -------------- -------------- -------------- -------------- 2 -------------- -------------- -------------- Liam/Trumpet -------------- 3 -------------- -------------- -------------- -------------- -------------- 4 -------------- -------------- -------------- Josh/Drums --------------

Still Pretty Easy Test
Input
M Tu W Th F 11 1 2 3 4 4 Ava Tuba M Tu W Th F 11 1 2 Ayla Flute M Tu W Th F 1 2 Jay Drums M Tu W Th F 11 1 3 Ryan Trumpet M Tu W Th F 11 2 4 2 Ayla Ava Ryan Jay
Output
Monday Tuesday Wednesday Thursday Friday 8 -------------- -------------- -------------- -------------- -------------- 9 -------------- -------------- -------------- -------------- -------------- 10 -------------- -------------- -------------- -------------- -------------- 11 -------------- -------------- -------------- -------------- Ava/Tuba LUNCH LUNCH LUNCH LUNCH LUNCH 1 -------------- -------------- -------------- -------------- Jay/Drums 2 -------------- -------------- -------------- -------------- Ayla/Flute 3 -------------- -------------- -------------- -------------- -------------- 4 -------------- -------------- -------------- -------------- Ryan/Trumpet

Validator 2 Validator
Input
M Tu W 8 9 10 11 1 2 3 Th F 7 Ali Saxophone M Tu W 11 1 Th F Bo Tuba M Tu W 10 2 3 Th F Cole Trumpet M Tu W 11 1 2 Th F Mia Clarinet M Tu W 9 3 Th F Sara Baritone M Tu W 8 1 3 Th F Tony Drums M Tu W 10 3 Th F Zoey Trombone M Tu W 10 3 Th F 3 Sara Bo Cole Zoey Mia Tony
Output
Monday Tuesday Wednesday Thursday Friday 8 -------------- -------------- Sara/Baritone -------------- -------------- 9 -------------- -------------- Mia/Clarinet -------------- -------------- 10 -------------- -------------- Zoey/Trombone -------------- -------------- 11 -------------- -------------- Ali/Saxophone -------------- -------------- LUNCH LUNCH LUNCH LUNCH LUNCH 1 -------------- -------------- Cole/Trumpet -------------- -------------- 2 -------------- -------------- Bo/Tuba -------------- -------------- 3 -------------- -------------- Tony/Drums -------------- -------------- 4 -------------- -------------- -------------- -------------- --------------

Long Day of Potential Conflicts Test
Input
M 8 9 10 11 1 2 3 Tu W Th F 7 Abby Flute M 8 10 11 1 Tu W Th F Izzy Drums M 9 11 1 Tu W Th F Josh Tuba M 11 1 2 3 Tu W Th F Kate Baritone M 8 11 3 Tu W Th F Leo Trumpet M 8 2 3 Tu W Th F MJ Clarinet M 9 10 3 Tu W Th F Mae Saxophone M 11 2 3 Tu W Th F 3 Abby MJ Kate Izzy Mae Leo
Output
Monday Tuesday Wednesday Thursday Friday 8 Abby/Flute -------------- -------------- -------------- -------------- 9 Izzy/Drums -------------- -------------- -------------- -------------- 10 MJ/Clarinet -------------- -------------- -------------- -------------- 11 Mae/Saxophone -------------- -------------- -------------- -------------- LUNCH LUNCH LUNCH LUNCH LUNCH 1 Josh/Tuba -------------- -------------- -------------- -------------- 2 Leo/Trumpet -------------- -------------- -------------- -------------- 3 Kate/Baritone -------------- -------------- -------------- -------------- 4 -------------- -------------- -------------- -------------- --------------

Validator 3 Validator
Input
M Tu W Th 8 9 10 11 1 2 3 F 7 Amy Trombone M Tu W Th 8 10 11 F Aria Clarinet M Tu W Th 8 9 1 3 F Bo Flute M Tu W Th 8 9 11 F Cole Drums M Tu W Th 9 10 11 F Cora Baritone M Tu W Th 10 11 2 3 F Drew Trumpet M Tu W Th 10 2 3 F MJ Tuba M Tu W Th 8 11 3 F 3 Cole Bo Drew Amy Cora MJ
Output
Monday Tuesday Wednesday Thursday Friday 8 -------------- -------------- -------------- Amy/Trombone -------------- 9 -------------- -------------- -------------- Bo/Flute -------------- 10 -------------- -------------- -------------- Cora/Baritone -------------- 11 -------------- -------------- -------------- Cole/Drums -------------- LUNCH LUNCH LUNCH LUNCH LUNCH 1 -------------- -------------- -------------- Aria/Clarinet -------------- 2 -------------- -------------- -------------- Drew/Trumpet -------------- 3 -------------- -------------- -------------- MJ/Tuba -------------- 4 -------------- -------------- -------------- -------------- --------------

Two Moderate Days Test
Input
M 11 1 2 3 4 Tu 9 10 11 1 W Th F 8 Alma Trombone M 1 3 Tu 11 W Th F Amy Saxophone M 2 4 Tu W Th F Gabe Flute M 11 4 Tu 11 W Th F Izzy Trombone M 2 Tu 9 10 11 W Th F Lola Clarinet M 11 3 Tu 11 1 W Th F MJ Flute M 3 Tu 9 1 W Th F Noah Drums M 1 3 Tu 9 10 W Th F Ryan Trumpet M 2 3 4 Tu 10 W Th F 3 Lola Amy Noah Izzy MJ Gabe
Output
Monday Tuesday Wednesday Thursday Friday 8 -------------- -------------- -------------- -------------- -------------- 9 -------------- Noah/Drums -------------- -------------- -------------- 10 -------------- -------------- -------------- -------------- -------------- 11 Lola/Clarinet Izzy/Trombone -------------- -------------- -------------- LUNCH LUNCH LUNCH LUNCH LUNCH 1 Alma/Trombone MJ/Flute -------------- -------------- -------------- 2 Amy/Saxophone -------------- -------------- -------------- -------------- 3 Ryan/Trumpet -------------- -------------- -------------- -------------- 4 Gabe/Flute -------------- -------------- -------------- --------------

Validator 4 Validator
Input
M Tu 11 1 2 3 4 W Th 11 1 2 3 4 F 8 Abby Drums M Tu 11 4 W Th 4 F Cole Clarinet M Tu 11 W Th 2 F Coop Trumpet M Tu 3 W Th 3 4 F Jim Flute M Tu 1 W Th 11 4 F John Baritone M Tu 2 4 W Th 11 2 F Josh Saxophone M Tu W Th 11 2 F Luke Trombone M Tu 11 3 4 W Th 4 F Nora Baritone M Tu 11 W Th 1 2 4 F 3 Jim John Coop Josh Cole Nora
Output
Monday Tuesday Wednesday Thursday Friday 8 -------------- -------------- -------------- -------------- -------------- 9 -------------- -------------- -------------- -------------- -------------- 10 -------------- -------------- -------------- -------------- -------------- 11 -------------- Abby/Drums -------------- Josh/Saxophone -------------- LUNCH LUNCH LUNCH LUNCH LUNCH 1 -------------- Jim/Flute -------------- -------------- -------------- 2 -------------- -------------- -------------- Cole/Clarinet -------------- 3 -------------- Luke/Trombone -------------- Coop/Trumpet -------------- 4 -------------- John/Baritone -------------- Nora/Baritone --------------

Three-Day Workweek Test
Input
M Tu 8 9 10 11 1 2 3 W Th 8 9 10 11 1 F 8 9 10 11 1 2 3 15 Amy Trumpet M Tu 11 W Th 8 F 9 1 Ayla Drums M Tu W Th 9 F 8 1 Cole Tuba M Tu 9 3 W Th F 8 Izzy Trombone M Tu 8 11 W Th 10 F JT Tuba M Tu 3 W Th 8 F Jim Drums M Tu 9 2 W Th 9 1 F Joe Trumpet M Tu 11 W Th F 9 11 2 Joy Trombone M Tu 1 W Th F 2 Liam Flute M Tu 8 1 W Th F 2 Lola Saxophone M Tu 1 W Th 11 F 8 10 Luke Baritone M Tu 9 W Th 8 9 F 3 Olly Clarinet M Tu 9 10 W Th 10 1 F Sara Trumpet M Tu 10 W Th F 10 3 Sean Baritone M Tu 10 1 W Th F 10 Tony Drums M Tu 9 11 2 3 W Th F 3 Tony Luke Liam Sara JT Izzy
Output
Monday Tuesday Wednesday Thursday Friday 8 -------------- Liam/Flute -------------- Amy/Trumpet Cole/Tuba 9 -------------- Tony/Drums -------------- Luke/Baritone -------------- 10 -------------- Olly/Clarinet -------------- Izzy/Trombone Sean/Baritone 11 -------------- Joe/Trumpet -------------- Lola/Saxophone -------------- LUNCH LUNCH LUNCH LUNCH LUNCH 1 -------------- Joy/Trombone -------------- Jim/Drums Ayla/Drums 2 -------------- -------------- -------------- -------------- -------------- 3 -------------- JT/Tuba -------------- -------------- Sara/Trumpet 4 -------------- -------------- -------------- -------------- --------------

Validator 5 Validator
Input
M 9 10 11 1 2 3 Tu 10 11 1 2 3 4 W Th 9 10 11 1 2 3 F 13 Ben Tuba M 1 2 Tu 4 W Th F Drew Trombone M 3 Tu 11 2 W Th F Ella Trumpet M 1 Tu 2 W Th 10 F Ivy Flute M 11 Tu 3 W Th 2 F JT Trumpet M Tu 2 W Th 9 11 F Jay Saxophone M 10 Tu 3 W Th 9 1 F Kate Baritone M 2 Tu 3 W Th 11 1 F Lola Baritone M 2 Tu 2 W Th F Luke Trombone M 11 Tu W Th 10 F Mike Drums M 10 Tu 10 W Th F Sam Tuba M 2 Tu W Th 2 F Sara Flute M Tu 1 W Th 10 F Tony Drums M 1 2 3 Tu W Th 9 F 3 Jay Luke Ella Ben Kate Sam
Output
Monday Tuesday Wednesday Thursday Friday 8 -------------- -------------- -------------- -------------- -------------- 9 -------------- -------------- -------------- JT/Trumpet -------------- 10 -------------- Mike/Drums -------------- Sara/Flute -------------- 11 Luke/Trombone -------------- -------------- Kate/Baritone -------------- LUNCH LUNCH LUNCH LUNCH LUNCH 1 Ella/Trumpet -------------- -------------- Jay/Saxophone -------------- 2 Lola/Baritone Drew/Trombone -------------- Sam/Tuba -------------- 3 Tony/Drums Ivy/Flute -------------- -------------- -------------- 4 -------------- Ben/Tuba -------------- -------------- --------------

Four Moderate Days Test
Input
M 11 1 2 3 4 Tu W 9 10 11 1 2 3 Th 8 9 10 F 10 11 1 2 3 18 Adam Trombone M Tu W 1 Th 9 F Aria Trumpet M 1 4 Tu W 2 Th 10 F 10 Ben Clarinet M 2 4 Tu W Th 9 10 F 3 Cora Tuba M 1 Tu W 10 Th F Doug Drums M 4 Tu W 1 Th 9 F Drew Trombone M Tu W 9 2 Th F 1 Emma Saxophone M 11 Tu W 3 Th F Isla Baritone M 3 Tu W 10 Th F JT Drums M 3 4 Tu W 1 Th 8 10 F 2 Jay Flute M 11 1 Tu W 9 1 Th 9 F 10 Joe Saxophone M 3 Tu W 9 10 11 Th F 1 Kai Trombone M 1 3 Tu W Th 9 F Nora Tuba M 1 Tu W 9 Th F 1 2 Ryan Trumpet M 4 Tu W 11 1 Th F 2 Sam Flute M 2 Tu W 3 Th F 11 Sean Clarinet M 11 Tu W 1 3 Th 8 F 1 Tony Baritone M 3 Tu W 1 Th 8 10 F 11 3 Zara Clarinet M Tu W 10 Th F 10 1 3 Cora Kai Emma Ryan Nora Ben
Output
Monday Tuesday Wednesday Thursday Friday 8 -------------- -------------- -------------- JT/Drums -------------- 9 -------------- -------------- Joe/Saxophone Jay/Flute -------------- 10 -------------- -------------- Cora/Tuba Aria/Trumpet Zara/Clarinet 11 Emma/Saxophone -------------- Ryan/Trumpet -------------- Sam/Flute LUNCH LUNCH LUNCH LUNCH LUNCH 1 Kai/Trombone -------------- Adam/Trombone -------------- Drew/Trombone 2 Ben/Clarinet -------------- -------------- -------------- Nora/Tuba 3 Isla/Baritone -------------- Sean/Clarinet -------------- Tony/Baritone 4 Doug/Drums -------------- -------------- -------------- --------------

Validator 6 Validator
Input
M 9 10 11 1 2 3 Tu 10 11 1 2 3 4 W 8 9 10 11 1 Th 10 11 1 2 3 4 F 23 Abby Trombone M 2 Tu 11 1 W Th 3 4 F Alma Drums M Tu 1 2 W 1 Th 11 1 F Ayla Clarinet M Tu 10 1 2 3 W Th 4 F Ben Tuba M 1 2 Tu 11 3 W 11 Th 11 F Bo Trumpet M 11 3 Tu W 10 1 Th 10 3 F Bob Drums M Tu W 8 Th 11 F Cole Tuba M 1 Tu 4 W 8 10 Th 3 F Drew Flute M 9 2 Tu 1 W Th 10 11 2 F Emma Trombone M Tu 10 1 W 8 11 Th F Gabe Drums M 11 2 Tu 1 W Th 10 11 3 F Ivy Baritone M 11 Tu 10 W 9 10 Th 3 F Izzy Trombone M 9 10 1 Tu W 10 Th 2 F Jim Tuba M 1 Tu W 1 Th F Jo Trumpet M 1 3 Tu 11 W Th F Joe Trumpet M Tu 2 3 W 11 Th 1 3 F Levi Clarinet M Tu W Th 11 4 F Liam Tuba M Tu W 11 Th 2 4 F Lola Flute M 10 1 Tu W Th 10 11 F Luke Clarinet M 10 Tu 2 3 W 8 1 Th 10 F MJ Drums M 9 11 Tu 11 W 8 10 Th 2 F Mae Saxophone M 2 Tu 3 W 10 11 1 Th 2 F Nora Trumpet M Tu W 1 Th 1 F Sara Saxophone M 10 3 Tu W Th 1 2 F 4 Jim Mae Ben Jo Joe Alma Bo Lola
Output
Monday Tuesday Wednesday Thursday Friday 8 -------------- -------------- Emma/Trombone -------------- -------------- 9 Izzy/Trombone -------------- Ivy/Baritone -------------- -------------- 10 Luke/Clarinet Ayla/Clarinet MJ/Drums Lola/Flute -------------- 11 Bo/Trumpet Jo/Trumpet Ben/Tuba Bob/Drums -------------- LUNCH LUNCH LUNCH LUNCH LUNCH 1 Jim/Tuba Drew/Flute Nora/Trumpet Joe/Trumpet -------------- 2 Gabe/Drums Alma/Drums -------------- Liam/Tuba -------------- 3 Sara/Saxophone Mae/Saxophone -------------- Abby/Trombone -------------- 4 -------------- Cole/Tuba -------------- Levi/Clarinet --------------

Four Days with Many Options Test
Input
M 11 1 2 3 4 Tu W 11 1 2 3 4 Th 10 11 1 2 3 F 8 9 10 11 1 2 3 19 Abby Flute M Tu W Th 1 F 1 Alex Trumpet M Tu W 1 Th 2 3 F Ali Tuba M 1 Tu W 1 Th 10 1 3 F Alma Baritone M 2 Tu W Th 2 3 F Amy Drums M Tu W 11 Th F 8 10 2 Aria Clarinet M 2 3 Tu W Th F 8 1 Coop Saxophone M Tu W 3 Th 2 F 8 10 2 Gabe Baritone M Tu W Th F 9 11 Izzy Flute M 2 Tu W 1 4 Th 10 F Jack Trombone M Tu W 11 Th F 11 Josh Baritone M 1 3 Tu W 3 Th 10 2 3 F 11 Leo Drums M 4 Tu W 4 Th 11 F Levi Drums M Tu W 1 Th 3 F 10 Mia Tuba M Tu W 3 4 Th F 2 Nora Flute M Tu W 4 Th 11 F Rae Trumpet M 4 Tu W 11 2 4 Th 10 2 F 10 Sam Clarinet M Tu W 11 1 4 Th 10 1 2 F 3 Wren Saxophone M Tu W 11 Th 10 2 3 F 10 11 3 Zoey Trombone M Tu W 2 Th F 1 3 Zoey Sam Alma Alex Nora Ali
Output
Monday Tuesday Wednesday Thursday Friday 8 -------------- -------------- -------------- -------------- Amy/Drums 9 -------------- -------------- -------------- -------------- Gabe/Baritone 10 -------------- -------------- -------------- Ali/Tuba Rae/Trumpet 11 -------------- -------------- Jack/Trombone -------------- Wren/Saxophone LUNCH LUNCH LUNCH LUNCH LUNCH 1 Josh/Baritone -------------- Alex/Trumpet Abby/Flute Zoey/Trombone 2 Izzy/Flute -------------- -------------- Alma/Baritone Mia/Tuba 3 Aria/Clarinet -------------- Coop/Saxophone Levi/Drums Sam/Clarinet 4 Leo/Drums -------------- Nora/Flute -------------- --------------

Validator 7 Validator
Input
M Tu 9 10 11 1 2 3 4 W 8 9 10 11 Th 10 11 1 2 3 4 F 8 9 10 11 1 19 Alma Saxophone M Tu W 9 Th 1 F 8 Anna Saxophone M Tu 9 1 W 8 Th 10 1 3 4 F Dave Tuba M Tu 10 W Th F 11 Doug Saxophone M Tu 1 2 3 W 11 Th F 8 1 Ella Trumpet M Tu 2 3 W Th F 8 JT Tuba M Tu 9 2 W 10 Th 3 F Jay Trumpet M Tu 1 3 W 9 Th 2 4 F 11 1 Jim Drums M Tu 9 11 3 W 10 Th F 11 Jo Drums M Tu 2 W 9 Th 1 3 F 11 Joe Trumpet M Tu W 11 Th 4 F Josh Trombone M Tu 1 W Th 2 F Kai Clarinet M Tu 9 3 W 8 9 Th 1 F Leo Baritone M Tu 9 11 W 10 11 Th 1 4 F 8 Lily Baritone M Tu W 10 Th 11 F 1 Lola Drums M Tu 10 3 W 9 Th 11 2 F 11 Luke Flute M Tu 9 11 W 8 11 Th F 8 Mae Trumpet M Tu W Th 11 3 F Sara Tuba M Tu W Th 10 1 F Sean Trombone M Tu 9 2 3 W Th F 10 1 4 Sean Lola Dave Jo Sara Lily Ella Alma
Output
Monday Tuesday Wednesday Thursday Friday 8 -------------- -------------- Luke/Flute -------------- Alma/Saxophone 9 -------------- JT/Tuba Jo/Drums -------------- -------------- 10 -------------- -------------- Lily/Baritone Sara/Tuba Sean/Trombone 11 -------------- Jim/Drums Joe/Trumpet Mae/Trumpet Dave/Tuba LUNCH LUNCH LUNCH LUNCH LUNCH 1 -------------- Josh/Trombone -------------- Kai/Clarinet Jay/Trumpet 2 -------------- Doug/Saxophone -------------- Lola/Drums -------------- 3 -------------- Ella/Trumpet -------------- Anna/Saxophone -------------- 4 -------------- -------------- -------------- Leo/Baritone --------------

Significant Free Time Test
Input
M 9 10 11 1 2 3 Tu W 8 9 10 11 1 Th 8 9 10 F 8 9 10 11 1 2 3 4 12 Alex Baritone M 2 Tu W Th F 11 1 3 Ayla Clarinet M Tu W 8 9 Th 9 F 3 Ivy Baritone M 10 2 Tu W Th F 8 11 Jo Trombone M 3 Tu W 8 10 Th F Kai Saxophone M 9 Tu W Th 9 F 9 Levi Drums M Tu W 9 10 Th F Lola Drums M 9 Tu W Th F 10 MJ Flute M 2 Tu W Th F 1 Mia Saxophone M 2 Tu W 8 9 Th F 11 Sean Drums M Tu W 10 Th F 9 Tony Trumpet M 9 2 Tu W Th 10 F 8 Zara Trombone M 10 Tu W Th 10 F 6 Tony Mia Jo Ivy MJ Alex Ayla Levi Lola Zara Sean Kai
Output
Monday Tuesday Wednesday Thursday Friday 8 -------------- -------------- Jo/Trombone -------------- -------------- 9 Lola/Drums -------------- Mia/Saxophone Kai/Saxophone Sean/Drums 10 Ivy/Baritone -------------- Levi/Drums Zara/Trombone -------------- 11 -------------- -------------- -------------- -------------- Alex/Baritone LUNCH LUNCH LUNCH LUNCH LUNCH 1 -------------- -------------- -------------- -------------- MJ/Flute 2 Tony/Trumpet -------------- -------------- -------------- -------------- 3 -------------- -------------- -------------- -------------- Ayla/Clarinet 4 -------------- -------------- -------------- -------------- --------------

Validator 8 Validator
Input
M 1 2 3 4 Tu 8 9 10 11 1 2 W Th 8 9 10 11 1 2 3 F 10 11 1 2 15 Adam Tuba M 1 Tu W Th 11 F Alex Tuba M Tu W Th 11 F 1 Ava Flute M 4 Tu W Th 8 F 2 Ayla Baritone M Tu 11 2 W Th F 2 Ben Trombone M 1 Tu 2 W Th 8 F 1 Cole Flute M 3 Tu 8 W Th F Drew Trumpet M Tu 8 W Th F 11 Izzy Trombone M Tu 9 W Th 2 F 11 Liam Saxophone M 3 Tu W Th F 1 2 Lily Trumpet M Tu 9 2 W Th F 10 2 Lola Drums M Tu W Th 11 F 11 Noah Tuba M Tu 1 2 W Th F Olly Drums M 4 Tu W Th 9 F Rae Trombone M 2 Tu 10 W Th F Ryan Baritone M 1 2 3 Tu W Th F 1 5 Ben Liam Noah Ayla Ryan Lily Rae Izzy Ava Lola
Output
Monday Tuesday Wednesday Thursday Friday 8 -------------- Cole/Flute -------------- Ava/Flute -------------- 9 -------------- Lily/Trumpet -------------- -------------- -------------- 10 -------------- -------------- -------------- -------------- -------------- 11 -------------- Ayla/Baritone -------------- Lola/Drums Drew/Trumpet LUNCH LUNCH LUNCH LUNCH LUNCH 1 Adam/Tuba Noah/Tuba -------------- -------------- Alex/Tuba 2 Rae/Trombone Ben/Trombone -------------- Izzy/Trombone Liam/Saxophone 3 Ryan/Baritone -------------- -------------- -------------- -------------- 4 Olly/Drums -------------- -------------- -------------- --------------

Five-Day Workweek Test
Input
M 8 9 10 11 1 2 3 Tu 8 9 10 11 1 2 3 W 9 10 11 1 2 3 Th 11 1 2 3 4 F 8 9 10 11 1 2 3 4 27 Adam Trumpet M 8 Tu 3 W 10 Th F 10 Ali Trombone M Tu 9 W 1 Th 1 F 11 Alma Drums M 1 Tu W 2 Th 1 F Anna Flute M 3 Tu 2 W Th 2 F Ben Clarinet M 8 Tu 10 W Th F 11 4 Bo Trombone M Tu 11 W 2 Th F 11 Bob Baritone M 3 Tu W 10 Th F 3 Dave Flute M Tu 2 W Th 11 3 F Doug Clarinet M Tu 11 1 W Th F 10 Ella Trombone M Tu W Th 3 F 8 9 Gabe Baritone M 11 Tu W 3 Th F 8 Isla Drums M Tu 11 W 10 2 Th F 2 Jack Saxophone M Tu 3 W 10 3 Th 2 F Jim Trumpet M 2 Tu W Th 4 F 2 Joe Drums M 11 Tu 1 W 9 Th F Josh Baritone M 9 Tu 8 1 W Th F 3 Kate Saxophone M 3 Tu W Th 2 F 1 Leo Drums M Tu 9 W 2 Th 2 F 1 Liam Drums M 9 11 Tu 10 W Th F Lily Clarinet M Tu W 10 Th 11 F 9 Lola Flute M 3 Tu 2 W 2 Th F 11 Mike Tuba M 9 10 Tu 3 W 3 Th F Olly Baritone M 2 Tu 3 W Th 1 F Ryan Tuba M 8 1 Tu 3 W Th 4 F Sam Trombone M 9 Tu 8 9 W Th F 8 Sean Saxophone M 11 Tu 9 W Th F 10 11 Zoey Trumpet M 11 Tu 10 W Th 2 3 F 10 Doug Zoey Bo Gabe Dave Anna Josh Ali Lily Alma Sean Bob Lola Sam Jim Liam Leo Isla Kate Joe
Output
Monday Tuesday Wednesday Thursday Friday 8 Ben/Clarinet -------------- -------------- -------------- Ella/Trombone 9 Sam/Trombone Leo/Drums Joe/Drums -------------- Lily/Clarinet 10 Mike/Tuba -------------- Jack/Saxophone -------------- Adam/Trumpet 11 Liam/Drums Bo/Trombone -------------- Dave/Flute Sean/Saxophone LUNCH LUNCH LUNCH LUNCH LUNCH 1 -------------- Doug/Clarinet Ali/Trombone Alma/Drums -------------- 2 Jim/Trumpet Anna/Flute Lola/Flute Kate/Saxophone Isla/Drums 3 Bob/Baritone Olly/Baritone Gabe/Baritone Zoey/Trumpet Josh/Baritone 4 -------------- -------------- -------------- Ryan/Tuba --------------

Validator 9 Validator
Input
M 9 10 11 1 2 Tu 8 9 10 11 1 2 3 4 W 8 9 10 11 1 2 3 4 Th 8 9 10 11 1 2 F 8 9 10 11 1 2 3 4 27 Adam Trombone M 9 Tu 9 W 9 10 Th F Alex Clarinet M 2 Tu 1 W 9 Th 9 F Ava Trumpet M 1 Tu W Th 9 11 1 F Ayla Trombone M Tu 3 W Th F 8 3 Cole Trumpet M Tu 3 4 W Th F 9 Dave Tuba M Tu 9 W 11 Th 10 F 1 Ella Flute M Tu 9 10 W 9 Th F 8 Gabe Trombone M Tu W 10 11 Th 9 2 F Isla Flute M 11 Tu 1 W Th 9 2 F Izzy Trombone M 11 Tu 8 3 4 W Th F Jack Tuba M 10 Tu W 4 Th F 3 Jay Baritone M Tu 11 4 W 11 Th F Jim Flute M 2 Tu 2 W 11 Th F Joe Saxophone M Tu 1 W 10 11 3 Th F Josh Clarinet M Tu 2 4 W 4 Th F Liam Flute M 10 Tu 10 11 W Th 11 F Lola Clarinet M Tu 1 W 9 11 Th F Luke Trombone M 10 Tu 4 W Th 10 2 F Luna Baritone M Tu 8 W 8 Th 2 F 1 Mae Trumpet M 10 Tu W 1 Th 11 F 9 Mike Drums M Tu W 10 Th 2 F 1 Ryan Tuba M Tu 8 11 1 W Th F Sam Clarinet M 9 Tu 2 W Th F 9 Sara Drums M Tu W 2 Th F 8 10 Tony Tuba M Tu W 9 Th F 10 3 Zara Drums M Tu 10 W Th 11 F 3 Zoey Drums M 1 Tu W 1 Th F 8 10 10 Josh Lola Ella Ava Liam Jay Sara Sam Tony Dave Jim Mike Jack Adam Luke Ryan Joe Zoey Ayla Luna
Output
Monday Tuesday Wednesday Thursday Friday 8 -------------- Izzy/Trombone Luna/Baritone -------------- Ella/Flute 9 Sam/Clarinet -------------- Lola/Clarinet Alex/Clarinet Mae/Trumpet 10 Luke/Trombone Zara/Drums Adam/Trombone Dave/Tuba Tony/Tuba 11 Isla/Flute Liam/Flute Jim/Flute Ava/Trumpet -------------- LUNCH LUNCH LUNCH LUNCH LUNCH 1 Zoey/Drums Ryan/Tuba -------------- -------------- Mike/Drums 2 -------------- Josh/Clarinet Sara/Drums Gabe/Trombone -------------- 3 -------------- Cole/Trumpet Joe/Saxophone -------------- Ayla/Trombone 4 -------------- Jay/Baritone Jack/Tuba -------------- --------------

Five Very Full Days I Test
Input
M 8 9 10 11 1 2 3 4 Tu 8 9 10 11 1 2 3 4 W 8 9 10 11 1 2 3 4 Th 8 9 10 11 1 2 3 4 F 8 9 10 11 1 2 3 4 34 Alex Trumpet M 9 Tu 8 2 W 1 Th 11 F 1 Amy Tuba M 9 Tu W Th 3 F 11 1 2 Aria Tuba M 1 Tu 3 4 W 10 4 Th 3 F Ava Flute M 9 2 Tu 8 W 2 Th 2 F 8 Ayla Tuba M Tu 9 1 W 1 Th 10 F 4 Ben Tuba M 10 Tu 10 11 W Th 8 10 F 2 Coop Clarinet M Tu 3 4 W 9 Th F Cora Baritone M Tu 10 W 4 Th 11 1 2 F Dave Trumpet M 1 4 Tu W 1 Th 4 F 3 Doug Clarinet M 4 Tu 10 11 W 2 Th 4 F 1 Drew Trumpet M Tu W 2 4 Th F 11 2 Emma Tuba M 10 4 Tu W 1 Th F Ivy Saxophone M Tu W 2 3 Th 10 F 11 1 4 Jim Trombone M Tu W Th 8 3 F Jo Flute M Tu 4 W 1 Th F 4 John Drums M 9 Tu 9 11 W 3 Th 10 F Joy Saxophone M 11 Tu 3 W 3 Th 1 F Kai Flute M 8 Tu 10 W 11 Th 11 F Kate Clarinet M Tu 9 W 3 Th 8 4 F 3 4 Leo Drums M Tu W Th 8 2 F Liam Saxophone M Tu 2 W 2 Th 8 1 F 2 Lily Drums M 1 4 Tu 4 W Th F Lola Flute M Tu W 9 2 Th F Luke Baritone M 4 Tu W 9 Th 3 4 F 9 Luna Trombone M 1 Tu 2 W Th 8 3 F 10 11 Mae Baritone M 2 Tu W Th 10 2 F 3 Mia Saxophone M 8 Tu W Th F 11 Noah Trumpet M 3 Tu 3 W Th 9 F Rae Clarinet M 1 Tu 10 W 10 Th F Ryan Drums M 3 Tu 10 W Th F 9 Sara Trumpet M 8 1 3 4 Tu W Th F 9 10 Wren Trombone M 9 Tu 8 W Th F Zara Flute M Tu 8 10 11 1 W Th F Zoey Trombone M 10 Tu W 1 Th F 12 Ayla Ava Amy Alex Kate Zoey Lily Sara Luna Luke Zara Rae Lola John Drew Dave Doug Joy Emma Leo Kai Jo Mae Liam
Output
Monday Tuesday Wednesday Thursday Friday 8 Mia/Saxophone Wren/Trombone -------------- Jim/Trombone -------------- 9 Amy/Tuba Ayla/Tuba Luke/Baritone -------------- Ryan/Drums 10 Zoey/Trombone Cora/Baritone Rae/Clarinet Mae/Baritone -------------- 11 -------------- John/Drums -------------- Kai/Flute Luna/Trombone LUNCH LUNCH LUNCH LUNCH LUNCH 1 Lily/Drums Zara/Flute Emma/Tuba Joy/Saxophone Alex/Trumpet 2 Ava/Flute Liam/Saxophone Lola/Flute Leo/Drums Ben/Tuba 3 Sara/Trumpet Noah/Trumpet Ivy/Saxophone Aria/Tuba Kate/Clarinet 4 Doug/Clarinet Coop/Clarinet Drew/Trumpet Dave/Trumpet Jo/Flute

Validator 10 Validator
Input
M 8 9 10 11 1 2 3 4 Tu 8 9 10 11 1 2 3 4 W 8 9 10 11 1 2 3 4 Th 8 9 10 11 1 2 3 4 F 8 9 10 11 1 2 3 4 34 Abby Drums M Tu 10 W 9 1 Th 9 F Alex Drums M 8 4 Tu W Th 9 11 F 11 2 Ali Tuba M 8 2 Tu 8 W 1 Th 8 F 8 Amy Flute M 11 Tu W 9 10 Th 1 F 10 1 Aria Saxophone M Tu 4 W 10 3 4 Th F 4 Ava Trumpet M 10 Tu 10 W Th F Ben Trombone M Tu W 9 3 Th F Bob Flute M 10 Tu W Th 2 F Cole Clarinet M 11 3 Tu 9 W 8 Th F 11 3 Dave Clarinet M 1 4 Tu W 9 Th F 8 Doug Trombone M 11 Tu 11 W 4 Th F 2 Drew Trombone M 8 9 Tu W Th F Gabe Flute M 10 Tu W 3 Th F Ivy Flute M Tu 8 11 W Th 10 F Izzy Drums M 8 9 10 Tu W 4 Th F 1 Jay Baritone M Tu 8 W Th F 1 Jo Drums M 11 Tu W 10 Th 9 F 8 9 1 Joe Drums M 9 Tu 1 3 W Th 11 F 10 1 Kai Tuba M Tu 8 11 3 W 8 Th F 10 Levi Tuba M 11 Tu W Th 8 F Liam Baritone M Tu 11 W 1 Th F 8 11 Lola Trumpet M 1 Tu 1 W Th F 9 3 Luke Trumpet M Tu W 1 Th F 8 11 2 3 MJ Tuba M Tu 10 W Th 11 F Mia Saxophone M Tu 10 1 3 W 8 Th 10 1 F Noah Saxophone M Tu W 8 11 Th F 4 Nora Baritone M 4 Tu 2 W Th F Olly Clarinet M Tu 4 W Th 10 F Ruby Trombone M Tu W Th 8 9 F 10 Ryan Clarinet M 3 Tu W 2 Th F Sean Clarinet M Tu 1 4 W 1 Th F 11 Tony Baritone M 3 Tu W 8 1 2 3 Th F Wren Saxophone M 2 Tu 8 W 4 Th 8 2 F 3 Zara Trumpet M 10 Tu 1 W 9 Th 1 4 F 11 10 Nora Drew Sean Ali Ava Ryan Aria Luke Izzy Alex Amy Ben Ruby Joe Jo Bob Ivy Levi Gabe Cole
Output
Monday Tuesday Wednesday Thursday Friday 8 Drew/Trombone Ivy/Flute Kai/Tuba Levi/Tuba Jo/Drums 9 -------------- Cole/Clarinet Ben/Trombone Abby/Drums -------------- 10 Ava/Trumpet MJ/Tuba -------------- Olly/Clarinet Ruby/Trombone 11 Amy/Flute Doug/Trombone Noah/Saxophone -------------- Sean/Clarinet LUNCH LUNCH LUNCH LUNCH LUNCH 1 Dave/Clarinet Lola/Trumpet Liam/Baritone Mia/Saxophone Jay/Baritone 2 Ali/Tuba Nora/Baritone Ryan/Clarinet Bob/Flute Luke/Trumpet 3 Tony/Baritone Joe/Drums Gabe/Flute -------------- Wren/Saxophone 4 Alex/Drums Aria/Saxophone Izzy/Drums Zara/Trumpet --------------

Five Very Full Days II Test
Input
M 8 9 10 11 1 2 3 4 Tu 8 9 10 11 1 2 3 4 W 8 9 10 11 1 2 3 4 Th 8 9 10 11 1 2 3 4 F 8 9 10 11 1 2 3 4 31 Alex Trombone M Tu W 9 Th F 11 Ali Trombone M 10 Tu 9 10 4 W Th 2 F 1 Anna Saxophone M Tu 9 W Th 8 9 3 F 11 Aria Tuba M 10 Tu W 1 Th F Ayla Saxophone M Tu 11 4 W Th 3 F 9 10 Bo Flute M 10 3 Tu 9 2 W Th 8 F 2 Bob Tuba M Tu 9 W 2 Th 9 F 9 Dave Saxophone M 3 Tu W 2 Th 8 F Doug Clarinet M Tu W 9 10 Th 4 F Ella Baritone M 10 1 Tu W Th 2 4 F Emma Drums M Tu 2 W 8 2 Th F 10 Ivy Flute M Tu 2 3 W 1 Th 8 F Izzy Tuba M Tu W Th F 2 4 Jay Baritone M 8 9 10 Tu W 10 3 4 Th F Jim Saxophone M 2 Tu W 2 4 Th 9 F 8 9 Joe Trumpet M 8 2 Tu W 9 Th F 9 3 John Trumpet M Tu W 3 Th 11 F Josh Clarinet M 9 Tu W Th 8 9 1 3 F Kai Saxophone M Tu W Th 10 3 F 4 Kate Baritone M Tu 11 4 W 10 2 Th F Levi Trumpet M Tu 9 W Th 3 F Lola Tuba M Tu 3 W Th F 8 Luke Trombone M Tu 2 W 4 Th 2 3 F 9 MJ Drums M 1 Tu W Th 9 10 11 F 8 10 Mia Trombone M Tu W 1 Th 4 F Nora Baritone M 8 Tu 2 W 2 Th 8 10 F 8 Rae Trumpet M Tu 11 W 9 Th 1 3 F 9 Sam Flute M Tu W 11 3 Th 3 F 1 Sean Drums M Tu 1 2 W Th 10 F 2 Tony Drums M Tu W 11 3 Th F 9 Zara Flute M 9 Tu W 3 Th 9 F 11 Emma Ella Ayla Josh Jay Ivy Tony Joe Nora Kate Alex Izzy Luke Sean John Kai Jim Anna MJ Sam Ali Bo
Output
Monday Tuesday Wednesday Thursday Friday 8 Jay/Baritone -------------- -------------- Bo/Flute Nora/Baritone 9 Zara/Flute Levi/Trumpet Alex/Trombone Bob/Tuba Luke/Trombone 10 Aria/Tuba -------------- Doug/Clarinet Kai/Saxophone -------------- 11 -------------- Ayla/Saxophone Tony/Drums MJ/Drums Anna/Saxophone LUNCH LUNCH LUNCH LUNCH LUNCH 1 -------------- -------------- Ivy/Flute Rae/Trumpet Sam/Flute 2 Joe/Trumpet Emma/Drums Kate/Baritone Ella/Baritone Sean/Drums 3 Dave/Saxophone Lola/Tuba John/Trumpet Josh/Clarinet -------------- 4 -------------- Ali/Trombone Jim/Saxophone Mia/Trombone Izzy/Tuba

Validator 11 Validator
Input
M 8 9 10 11 1 2 3 4 Tu 8 9 10 11 1 2 3 4 W 8 9 10 11 1 2 3 4 Th 8 9 10 11 1 2 3 4 F 8 9 10 11 1 2 3 4 33 Adam Baritone M 8 1 Tu W 3 Th 1 F 4 Alex Saxophone M 9 Tu 10 W 10 4 Th 9 F 8 Alma Flute M Tu W Th 1 F 4 Amy Drums M 9 Tu 3 W Th F 4 Anna Clarinet M 1 Tu 9 3 W 3 Th 4 F Ava Baritone M Tu W 2 3 Th 9 2 3 F 10 Ben Trumpet M Tu W Th 10 2 F Bo Trombone M Tu 2 W 3 Th 11 F Cole Drums M 10 Tu W 8 Th F 11 2 Coop Trombone M 11 Tu 11 W 10 1 Th 11 F Cora Trombone M 1 Tu W Th 11 F 11 Dave Tuba M Tu W 3 Th 8 11 4 F 8 1 Doug Saxophone M 1 4 Tu 10 3 W Th F Drew Drums M 9 11 Tu 4 W 9 Th 1 F 8 Emma Trumpet M 10 Tu 10 11 W Th 4 F Ivy Baritone M 8 4 Tu 9 W 8 Th 11 4 F JT Saxophone M 10 1 Tu 11 W 9 Th F Jim Tuba M Tu W 1 Th 10 F 4 John Flute M 4 Tu 3 W 4 Th 2 F Josh Trombone M 2 4 Tu 9 W 9 Th 8 F 2 Joy Drums M Tu W 1 Th 8 4 F 4 Kate Trumpet M 10 Tu 8 11 2 W Th F 9 3 Leo Tuba M Tu 9 W 10 Th 10 4 F 2 Lola Saxophone M Tu W 1 Th 1 F Luna Flute M 9 1 Tu 10 W 2 3 Th F 10 Mae Trumpet M Tu 10 W 10 Th F 8 Nora Trumpet M Tu 9 10 2 W Th F 2 Olly Flute M 1 Tu W Th F 10 Ruby Clarinet M 4 Tu W 8 3 Th F 9 Ryan Clarinet M 10 2 Tu 10 3 W 3 Th F Sara Clarinet M 8 2 Tu W 3 Th 9 F 9 Sean Clarinet M 8 Tu 9 W 1 4 Th 8 11 F Wren Baritone M Tu 1 W Th 9 4 F 12 Wren JT Olly Cora Drew Leo Dave Ivy Ruby Alex Jim Adam Cole Alma Mae Luna John Nora Ava Amy Josh Ben Bo Kate
Output
Monday Tuesday Wednesday Thursday Friday 8 Adam/Baritone Kate/Trumpet Cole/Drums Joy/Drums Drew/Drums 9 Alex/Saxophone Anna/Clarinet JT/Saxophone Sara/Clarinet Ruby/Clarinet 10 Emma/Trumpet Doug/Saxophone Mae/Trumpet Ben/Trumpet Ava/Baritone 11 -------------- Coop/Trombone -------------- Ivy/Baritone Cora/Trombone LUNCH LUNCH LUNCH LUNCH LUNCH 1 Olly/Flute Wren/Baritone Jim/Tuba Lola/Saxophone Dave/Tuba 2 Ryan/Clarinet -------------- Luna/Flute John/Flute Nora/Trumpet 3 -------------- Amy/Drums Bo/Trombone -------------- -------------- 4 Josh/Trombone -------------- Sean/Clarinet Leo/Tuba Alma/Flute

Solution language

Solution

Stub generator input