aboutsummaryrefslogtreecommitdiff
path: root/challenge-128
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2021-09-05 21:10:20 +0100
committerGitHub <noreply@github.com>2021-09-05 21:10:20 +0100
commit168b5480fe2c5c30f2a88082dfdc3afdffb4d821 (patch)
tree26ce0e4359a41c3de8256798f90bfff6bb41a792 /challenge-128
parent7e721cd8deec8e7bec05b20309d4aec40651fbbf (diff)
parent78c3559e2ff489f3c11d139cbb1437826d67d289 (diff)
downloadperlweeklychallenge-club-168b5480fe2c5c30f2a88082dfdc3afdffb4d821.tar.gz
perlweeklychallenge-club-168b5480fe2c5c30f2a88082dfdc3afdffb4d821.tar.bz2
perlweeklychallenge-club-168b5480fe2c5c30f2a88082dfdc3afdffb4d821.zip
Merge pull request #4841 from Abigail/abigail/week-128
Abigail/week 128
Diffstat (limited to 'challenge-128')
-rw-r--r--challenge-128/abigail/README.md95
-rw-r--r--challenge-128/abigail/awk/ch-2.awk55
-rw-r--r--challenge-128/abigail/blog.txt1
-rw-r--r--challenge-128/abigail/blog1.txt1
-rw-r--r--challenge-128/abigail/c/ch-2.c106
-rw-r--r--challenge-128/abigail/lua/ch-2.lua67
-rw-r--r--challenge-128/abigail/node/ch-2.js49
-rw-r--r--challenge-128/abigail/perl/ch-1.pl73
-rw-r--r--challenge-128/abigail/perl/ch-2.pl83
-rw-r--r--challenge-128/abigail/python/ch-2.py37
-rw-r--r--challenge-128/abigail/t/ctest.ini11
-rw-r--r--challenge-128/abigail/t/input-1-13
-rw-r--r--challenge-128/abigail/t/input-1-23
-rw-r--r--challenge-128/abigail/t/input-2-12
-rw-r--r--challenge-128/abigail/t/input-2-22
-rw-r--r--challenge-128/abigail/t/input-2-32
-rw-r--r--challenge-128/abigail/t/output-1-1.exp3
-rw-r--r--challenge-128/abigail/t/output-1-2.exp3
-rw-r--r--challenge-128/abigail/t/output-2-1.exp1
-rw-r--r--challenge-128/abigail/t/output-2-2.exp1
-rw-r--r--challenge-128/abigail/t/output-2-3.exp1
21 files changed, 547 insertions, 52 deletions
diff --git a/challenge-128/abigail/README.md b/challenge-128/abigail/README.md
index 0c99f58d44..b4279b09ff 100644
--- a/challenge-128/abigail/README.md
+++ b/challenge-128/abigail/README.md
@@ -1,92 +1,83 @@
# Solutions by Abigail
-## [Disjoint Sets][task1]
+## [Maximum Sub-Matrix][task1]
-> You are given two sets with unique integers.
+> You are given m x n binary matrix having 0 or 1.
>
-> Write a script to figure out if they are disjoint.
->
-> > The two sets are disjoint if they don't have any common members.
+> Write a script to find out maximum sub-matrix having only 0
### Examples
~~~~
-Input: @S1 = (1, 2, 5, 3, 4)
- @S2 = (4, 6, 7, 8, 9)
-~~~~
-
-Output: `0` as the given two sets have common member `4`.
+Input : [ 1 0 0 0 1 0 ]
+ [ 1 1 0 0 0 1 ]
+ [ 1 0 0 0 0 0 ]
+Output: [ 0 0 0 ]
+ [ 0 0 0 ]
~~~~
-Input: @S1 = (1, 3, 5, 7, 9)
- @S2 = (0, 2, 4, 6, 8)
+
~~~~
+Input : [ 0 0 1 1 ]
+ [ 0 0 0 1 ]
+ [ 0 0 1 0 ]
-Output: `1` as the given two sets do not have common member.
+Output: [ 0 0 ]
+ [ 0 0 ]
+ [ 0 0 ]
+~~~~
### Solutions
-* [AWK](awk/ch-1.awk)
-* [Bash](bash/ch-1.sh)
-* [C](c/ch-1.c)
-* [Lua](lua/ch-1.lua)
-* [Node.js](node/ch-1.js)
* [Perl](perl/ch-1.pl)
-* [Python](python/ch-1.py)
-* [Ruby](ruby/ch-1.rb)
### Blog
-[Perl Weekly Challenge 127: Disjoint Sets][blog1]
+[Perl Weekly Challenge 128: Maximum Sub-Matrix][blog1]
-## [Conflict Intervals][task2]
+## [Minimum Platforms][task2]
-> You are given a list of intervals.
+> You are given two arrays of arrival and departure times of trains
+> at a railway station.
>
-> Write a script to find out if the current interval conflicts with
-> any of the previous intervals.
+> Write a script to find out the minimum number of platforms needed
+> so that no train needs to wait.
### Examples
~~~~
-Input: @Intervals = [(1,4), (3,5), (6,8), (12, 13), (3,20)]
-Output: [(3,5), (3,20)]
+Input: @arrivals = (11:20, 14:30)
+ @departutes = (11:50, 15:00)
+Output: 1
~~~~
-* The 1st interval `(1,4)` do not have any previous intervals to compare with,
- so skip it.
-* The 2nd interval `(3,5)` does conflict with previous interval (1,4).
-* The 3rd interval `(6,8)` do not conflicts with any of the previous intervals
- `(1,4)` and `(3,5)`, so skip it.
-* The 4th interval `(12,13)` again do not conflicts with any of the previous
- intervals `(1,4)`, `(3,5)` and `(6,8)`, so skip it.
-* The 5th interval `(3,20)` conflicts with the first interval `(1,4)`.
+The 1st arrival of train is at 11:20 and this is the only train at
+the station, so you need 1 platform. Before the second arrival at
+14:30, the first train left the station at 11:50, so you still need
+only 1 platform.
~~~~
-Input: @Intervals = [(3,4), (5,7), (6,9), (10, 12), (13,15)]
-Output: [(6,9)]
+Input: @arrivals = (10:20, 11:00, 11:10, 12:20, 16:20, 19:00)
+ @departutes = (10:30, 13:20, 12:40, 12:50, 20:20, 21:20)
+Output: 3
~~~~
-* The 1st interval `(3,4)` do not have any previous intervals to compare with,
- so skip it.
-* The 2nd interval `(5,7)` do not conflicts with the previous interval `(3,4)`,
- so skip it.
-* The 3rd interval `(6,9)` does conflict with one of the previous
- intervals `(5,7)`.
-* The 4th interval `(10,12)` do not conflicts with any of the previous
- intervals `(3,4)`, `(5,7)` and `(6,9)`, so skip it.
-* The 5th interval `(13,15)` do not conflicts with any of the previous
- intervals `(3,4)`, `(5,7)`, `(6,9)` and `(10,12)`, so skip it.
+Between 11:00 and 12:20, there would be at least 3 trains at the
+station, so we need minimum 3 platforms.
### Solutions
* [AWK](awk/ch-2.awk)
+* [C](awk/ch-2.c)
+* [Lua](lua/ch-2.lua)
+* [Node.js](node/ch-2.js)
* [Perl](perl/ch-2.pl)
+* [Python](python/ch-2.py)
### Blog
-[Perl Weekly Challenge 127: Conflict Intervals][blog2]
+[Perl Weekly Challenge 128: Minimum Platforms][blog2]
-[task1]: https://perlweeklychallenge.org/blog/perl-weekly-challenge-127/#TASK1
-[task2]: https://perlweeklychallenge.org/blog/perl-weekly-challenge-127/#TASK2
-[blog1]: https://abigail.github.io/HTML/Perl-Weekly-Challenge/week-127-1.html
-[blog2]: https://abigail.github.io/HTML/Perl-Weekly-Challenge/week-127-2.html
+[task1]: https://perlweeklychallenge.org/blog/perl-weekly-challenge-128/#TASK1
+[task2]: https://perlweeklychallenge.org/blog/perl-weekly-challenge-128/#TASK2
+[blog1]: https://abigail.github.io/HTML/Perl-Weekly-Challenge/week-128-1.html
+[blog2]: https://abigail.github.io/HTML/Perl-Weekly-Challenge/week-128-2.html
diff --git a/challenge-128/abigail/awk/ch-2.awk b/challenge-128/abigail/awk/ch-2.awk
new file mode 100644
index 0000000000..0cad0ea91d
--- /dev/null
+++ b/challenge-128/abigail/awk/ch-2.awk
@@ -0,0 +1,55 @@
+#!/usr/bin/awk
+
+#
+# See ../README.md
+#
+
+#
+# Run as: awk -f ch-2.awk < input-file
+#
+
+
+BEGIN {
+ for (i = 0; i < 24 * 60; i ++) {
+ trains [i] = 0
+ }
+}
+
+NR <= 2 {
+ for (i = 1; i <= NF; i ++) {
+ gsub ("[^0-9:]", "", $i)
+ split ($i, chunks, ":")
+ minutes = 60 * chunks [1] + chunks [2]
+ if (NR == 1) {
+ arrivals [i] = minutes
+ }
+ else {
+ departures [i] = minutes
+ }
+ }
+}
+
+END {
+ for (i = 1; i <= length (arrivals); i ++) {
+ if (arrivals [i] < departures [i]) {
+ for (minute = arrivals [i]; minute <= departures [i]; minute ++) {
+ trains [minute] ++
+ }
+ }
+ else {
+ for (minute = 0; minute <= departures [i]; minute ++) {
+ trains [minute] ++
+ }
+ for (minute = arrivals [i]; minute < 24 * 60; minute ++) {
+ trains [minute] ++
+ }
+ }
+ }
+ max = 0
+ for (i = 0; i < 24 * 60; i ++) {
+ if (max <= trains [i]) {
+ max = trains [i]
+ }
+ }
+ print max
+}
diff --git a/challenge-128/abigail/blog.txt b/challenge-128/abigail/blog.txt
new file mode 100644
index 0000000000..6e3d058643
--- /dev/null
+++ b/challenge-128/abigail/blog.txt
@@ -0,0 +1 @@
+https://abigail.github.io/HTML/Perl-Weekly-Challenge/week-128-1.html
diff --git a/challenge-128/abigail/blog1.txt b/challenge-128/abigail/blog1.txt
new file mode 100644
index 0000000000..3c20921d6a
--- /dev/null
+++ b/challenge-128/abigail/blog1.txt
@@ -0,0 +1 @@
+https://abigail.github.io/HTML/Perl-Weekly-Challenge/week-128-2.html
diff --git a/challenge-128/abigail/c/ch-2.c b/challenge-128/abigail/c/ch-2.c
new file mode 100644
index 0000000000..260fb60332
--- /dev/null
+++ b/challenge-128/abigail/c/ch-2.c
@@ -0,0 +1,106 @@
+# include <stdlib.h>
+# include <stdio.h>
+# include <string.h>
+
+/*
+ * See ../README.md
+ */
+
+/*
+ * Run as: cc -o ch-2.o ch-2.c; ./ch-2.o < input-file
+ */
+# define MINUTES_PER_DAY 24 * 60
+
+int main (void) {
+ char * arrival_line = NULL;
+ char * departure_line = NULL;
+ size_t a_len = 0;
+ size_t d_len = 0;
+ size_t a_str_len;
+ size_t d_str_len;
+
+ if ((a_str_len = getline (&arrival_line, &a_len, stdin)) == -1) {
+ perror ("Failed to read arrival line");
+ exit (1);
+ }
+ if ((d_str_len = getline (&departure_line, &d_len, stdin)) == -1) {
+ perror ("Failed to read departurerrival line");
+ exit (1);
+ }
+
+ /*
+ * Turn any non-digits into spaces.
+ */
+ char * line_ptr = arrival_line;
+ while (* line_ptr) {
+ if (* line_ptr < '0' || * line_ptr > '9') {
+ * line_ptr = ' ';
+ }
+ line_ptr ++;
+ }
+
+ line_ptr = departure_line;
+ while (* line_ptr) {
+ if (* line_ptr < '0' || * line_ptr > '9') {
+ * line_ptr = ' ';
+ }
+ line_ptr ++;
+ }
+
+ /*
+ * Initialize the trains array: a counter for every minute in a day
+ */
+ unsigned int trains [MINUTES_PER_DAY];
+ for (size_t i = 0; i < MINUTES_PER_DAY; i ++) {
+ trains [i] = 0;
+ }
+
+ /*
+ * Scan over the arrival/departure times
+ */
+ int a_hour, a_minute, d_hour, d_minute;
+ int a_skip = 0;
+ int d_skip = 0;
+ char * a_ptr = arrival_line;
+ char * d_ptr = departure_line;
+ while (sscanf (a_ptr, "%d %d%n", &a_hour, &a_minute, &a_skip) == 2 &&
+ sscanf (d_ptr, "%d %d%n", &d_hour, &d_minute, &d_skip) == 2) {
+ int arrival = a_hour * 60 + a_minute;
+ int departure = d_hour * 60 + d_minute;
+ a_ptr += a_skip;
+ d_ptr += d_skip;
+
+ /*
+ * Count the number of trains there are in the station for each
+ * minute of the day
+ */
+ for (int i = arrival; i <= departure; i ++) {
+ trains [i] ++;
+ }
+ if (departure < arrival) {
+ for (int i = 0; i <= departure; i ++) {
+ trains [i] ++;
+ }
+ for (int i = arrival; i < MINUTES_PER_DAY; i ++) {
+ trains [i] ++;
+ }
+ }
+ }
+
+ /*
+ * Find the maximum number of trains
+ */
+ int max = 0;
+ for (int i = 0; i < MINUTES_PER_DAY; i ++) {
+ if (max < trains [i]) {
+ max = trains [i];
+ }
+ }
+
+ printf ("%d\n", max);
+
+ free (arrival_line);
+ free (departure_line);
+
+ return (0);
+}
diff --git a/challenge-128/abigail/lua/ch-2.lua b/challenge-128/abigail/lua/ch-2.lua
new file mode 100644
index 0000000000..522cf76960
--- /dev/null
+++ b/challenge-128/abigail/lua/ch-2.lua
@@ -0,0 +1,67 @@
+#!/opt/local/bin/lua
+
+--
+-- See ../README.md
+--
+
+--
+-- Run as: lua ch-2.lua < input-file
+--
+
+
+--
+-- Read the input, and convert it to minutes (from midnight)
+--
+
+local arrivals = {}
+local departures = {}
+
+for hour, minute in io . read ("*l") : gmatch ("([0-9][0-9]):([0-9][0-9])") do
+ arrivals [#arrivals + 1] = 60 * tonumber (hour) + tonumber (minute)
+end
+for hour, minute in io . read ("*l") : gmatch ("([0-9][0-9]):([0-9][0-9])") do
+ departures [#departures + 1] = 60 * tonumber (hour) + tonumber (minute)
+end
+
+--
+-- Initialize the trains array, which counts the number of trains
+-- in the station on each minute of the day.
+--
+local trains = {}
+for i = 0, 24 * 60 - 1 do
+ trains [i] = 0
+end
+
+--
+-- Process each train
+--
+for i, arrival in ipairs (arrivals) do
+ local departure = departures [i]
+ if arrival < departure then
+ for i = arrival, departure do
+ trains [i] = trains [i] + 1
+ end
+ else
+ for i = 0, departure do
+ trains [i] = trains [i] + 1
+ end
+ for i = arrival, 24 * 60 - 1 do
+ trains [i] = trains [i] + 1
+ end
+ end
+end
+
+--
+-- Find the maximum
+--
+local max = 0
+for i, count in ipairs (trains) do
+ if max < count then
+ max = count
+ end
+end
+
+--
+-- And print it
+--
+print (max)
diff --git a/challenge-128/abigail/node/ch-2.js b/challenge-128/abigail/node/ch-2.js
new file mode 100644
index 0000000000..0f0987c00c
--- /dev/null
+++ b/challenge-128/abigail/node/ch-2.js
@@ -0,0 +1,49 @@
+#!/usr/local/bin/node
+
+//
+// See ../README.md
+//
+
+//
+// Run as: node ch-2.js < input-file
+//
+
+let first_line = 1
+let arrivals = []
+let departures = []
+
+ require ('readline')
+. createInterface ({input: process . stdin})
+. on ('line', line => {
+ let times = line . match (/[0-9][0-9]:[0-9][0-9]/g)
+ . map (_ => _ . split (/:/) . map (_ => +_))
+ . map (_ => 60 * _ [0] + _ [1])
+ if (first_line) {
+ arrivals = times
+ first_line = 0
+ }
+ else {
+ departures = times
+ }
+})
+. on ('close', () => {
+ let trains = []
+ for (i = 0; i < 24 * 60; i ++) {
+ trains [i] = 0
+ }
+ arrivals . forEach ((arrival, index) => {
+ let departure = departures [index]
+ for (i = arrival; i <= departure; i ++) {
+ trains [i] ++
+ }
+ if (arrival > departure) {
+ for (i = 0; i <= departure; i ++) {
+ trains [i] ++
+ }
+ for (i = arrival; i < 24 * 60; i ++) {
+ trains [i] ++
+ }
+ }
+ })
+ console . log (Math . max (... trains))
+})
diff --git a/challenge-128/abigail/perl/ch-1.pl b/challenge-128/abigail/perl/ch-1.pl
new file mode 100644
index 0000000000..d80d72aaa5
--- /dev/null
+++ b/challenge-128/abigail/perl/ch-1.pl
@@ -0,0 +1,73 @@
+#!/opt/perl/bin/perl
+
+use 5.032;
+
+use strict;
+use warnings;
+no warnings 'syntax';
+
+use experimental 'signatures';
+use experimental 'lexical_subs';
+
+use FindBin;
+use IPC::Open2;
+
+#
+# See ../README.md
+#
+
+#
+# Run as: perl ch-1.pl < input-file
+#
+
+#
+# This is almost exactly the same as week 87, part 1, with two, trivial,
+# differences:
+#
+# - In week 087, we wanted the largest rectangle containing 1s
+# instead of 0s.
+# - In week 087, a largest rectangle of '1x1' didn't count,
+# and a 0 needed to be printed instead.
+#
+
+#
+# So, we will "solve" is challenge by just calling the solution
+# of week 87, with some pre and post processing of the input
+# and output:
+#
+# - We will swap the 0s and 1s in the input.
+# - We'll replace any 1s in the output with 0s. (If the largest
+# rectangle is a 1x1 rectangle, week 87 would return a 0 -- which
+# *IS* a 1x1 rectangle...)
+#
+
+#
+# Note also that the first example is a bit misleading. It says the
+# largest sub-matrix is:
+#
+# 0 0 0
+# 0 0 0
+#
+# But that's only one of the largest. There is an equally large rectangle
+# shaped like this:
+#
+# 0 0
+# 0 0
+# 0 0
+#
+# (Someone really should start proofreading those challenges)
+#
+
+my $program = "$FindBin::Bin/../../../challenge-087/abigail/perl/ch-2.pl";
+
+my $pid = open2 (my $out, my $in, $^X, $program) // die "open failed: $!";
+
+print $in y/01/10/r while <>;
+
+close $in;
+
+print y/1/0/r while <$out>;
+
+waitpid ($pid, 0);
+
+__END__
diff --git a/challenge-128/abigail/perl/ch-2.pl b/challenge-128/abigail/perl/ch-2.pl
new file mode 100644
index 0000000000..f821891b94
--- /dev/null
+++ b/challenge-128/abigail/perl/ch-2.pl
@@ -0,0 +1,83 @@
+#!/opt/perl/bin/perl
+
+use 5.032;
+
+use strict;
+use warnings;
+no warnings 'syntax';
+
+use experimental 'signatures';
+use experimental 'lexical_subs';
+
+use List::Util qw [max];
+
+#
+# See ../README.md
+#
+
+#
+# Run as: perl ch-2.pl < input-file
+#
+# The input is assumed to consist of two lines: the first with arrival
+# times, the second one with departure times.
+#
+
+#
+# One way of solving this is to scan over the arrivals and departures,
+# keeping a running count of platforms required, adding 1 for an arrival,
+# and subtracting 1 for a departure. However, this requires the times
+# to be sorted, and we are not given that the points are. Sorting would
+# require Omega (N log N) time.
+#
+# Alternatively, we could put the times the trains are in the station
+# in an interval tree, or a segment tree, and perform stabbing queries
+# with each of the arrival points. But building either tree requires
+# Omega (N log N) time.
+#
+# Instead, we will solve the problem in linear time, taking advantage
+# there are only a fixed number of minutes in a day. We start with an
+# array of 1440 (the number of minutes in a day) 0s. Then, for each
+# train, we add 1 for each of the minutes the train stays at the station
+# (if the departure time is before the arrival time, we assume the
+# train is at the station during midnight, and use the appropriate minutes).
+# If we have processed each train, we find the maximum in the array.
+#
+# This obviously only takes O (N) time.
+#
+# Assumptions:
+# - If train A departures at time X, while train B arrives at time X,
+# the cannot share the same platform.
+# - There is no minimum distance between trains; that is, if train A
+# leaves a platform at time X, train B can arrive at the platform
+# at time X + 1.
+# - No two trains can share a platform. Either the platforms are
+# short, or the trains are long.
+#
+
+my @arrivals = map {[split /:/]} <> =~ /[0-9][0-9]:[0-9][0-9]/g;
+my @departures = map {[split /:/]} <> =~ /[0-9][0-9]:[0-9][0-9]/g;
+
+my @trains = (0) x (24 * 60);
+
+foreach my $i (keys @arrivals) {
+ my $arrival = 60 * $arrivals [$i] [0] + $arrivals [$i] [1];
+ my $departure = 60 * $departures [$i] [0] + $departures [$i] [1];
+ my @minutes;
+ if ($arrival <= $departure) {
+ #
+ # Train arrives and leaves before midnight.
+ #
+ @minutes = $arrival .. $departure;
+ }
+ else {
+ #
+ # Train arrives before midnight, leaves after midnight.
+ #
+ @minutes = (0 .. $departure, $arrival .. (24 * 60 - 1));
+ }
+ $trains [$_] ++ for @minutes;
+}
+
+say max @trains;
+
+__END__
diff --git a/challenge-128/abigail/python/ch-2.py b/challenge-128/abigail/python/ch-2.py
new file mode 100644
index 0000000000..85cb8df8e6
--- /dev/null
+++ b/challenge-128/abigail/python/ch-2.py
@@ -0,0 +1,37 @@
+#!/opt/local/bin/python
+
+#
+# See ../README.md
+#
+
+#
+# Run as: python ch-1.py < input-file
+#
+
+import re
+
+def get_time (time):
+ hours, minutes = map (lambda x: int (x), time . split (":"))
+ return (60 * hours + minutes)
+
+def read_times ():
+ return (list (map (get_time,
+ re . findall (r'[0-9][0-9]:[0-9][0-9]', input ()))))
+
+arrivals = read_times ()
+departures = read_times ()
+
+trains = [0] * (24 * 60)
+
+for i in range (len (arrivals)):
+ arrival = arrivals [i]
+ departure = departures [i]
+ for i in range (arrival, departure + 1):
+ trains [i] = trains [i] + 1
+ if departure < arrival:
+ for i in range (0, departure + 1):
+ trains [i] = trains [i] + 1
+ for i in range (arrival, 24 * 60):
+ trains [i] = trains [i] + 1
+
+print (max (trains))
diff --git a/challenge-128/abigail/t/ctest.ini b/challenge-128/abigail/t/ctest.ini
new file mode 100644
index 0000000000..1968e87fdb
--- /dev/null
+++ b/challenge-128/abigail/t/ctest.ini
@@ -0,0 +1,11 @@
+#
+# Configuration file for running tests, using ctest.
+# See https://github.com/Abigail/Misc/blob/master/ctest
+#
+
+[names]
+1-1 = Given Example 1
+1-2 = Given Example 2
+2-1 = Given Example 1
+2-2 = Given Example 2
+2-3 = Trains staying overnight
diff --git a/challenge-128/abigail/t/input-1-1 b/challenge-128/abigail/t/input-1-1
new file mode 100644
index 0000000000..ff85c9f967
--- /dev/null
+++ b/challenge-128/abigail/t/input-1-1
@@ -0,0 +1,3 @@
+1 0 0 0 1 0
+1 1 0 0 0 1
+1 0 0 0 0 0
diff --git a/challenge-128/abigail/t/input-1-2 b/challenge-128/abigail/t/input-1-2
new file mode 100644
index 0000000000..91776b27bc
--- /dev/null
+++ b/challenge-128/abigail/t/input-1-2
@@ -0,0 +1,3 @@
+0 0 1 1
+0 0 0 1
+0 0 1 0
diff --git a/challenge-128/abigail/t/input-2-1 b/challenge-128/abigail/t/input-2-1
new file mode 100644
index 0000000000..e19ab08173
--- /dev/null
+++ b/challenge-128/abigail/t/input-2-1
@@ -0,0 +1,2 @@
+(11:20, 14:30)
+(11:50, 15:00)
diff --git a/challenge-128/abigail/t/input-2-2 b/challenge-128/abigail/t/input-2-2
new file mode 100644
index 0000000000..22433a47a9
--- /dev/null
+++ b/challenge-128/abigail/t/input-2-2
@@ -0,0 +1,2 @@
+(10:20, 11:00, 11:10, 12:20, 16:20, 19:00)
+(10:30, 13:20, 12:40, 12:50, 20:20, 21:20)
diff --git a/challenge-128/abigail/t/input-2-3 b/challenge-128/abigail/t/input-2-3
new file mode 100644
index 0000000000..cce7d56878
--- /dev/null
+++ b/challenge-128/abigail/t/input-2-3
@@ -0,0 +1,2 @@
+(10:20, 11:00, 11:10, 12:20, 16:20, 19:00, 05:00)
+(10:30, 13:20, 12:40, 12:50, 20:20, 21:20, 04:00)
diff --git a/challenge-128/abigail/t/output-1-1.exp b/challenge-128/abigail/t/output-1-1.exp
new file mode 100644
index 0000000000..8f34313f74
--- /dev/null
+++ b/challenge-128/abigail/t/output-1-1.exp
@@ -0,0 +1,3 @@
+0 0
+0 0
+0 0
diff --git a/challenge-128/abigail/t/output-1-2.exp b/challenge-128/abigail/t/output-1-2.exp
new file mode 100644
index 0000000000..8f34313f74
--- /dev/null
+++ b/challenge-128/abigail/t/output-1-2.exp
@@ -0,0 +1,3 @@
+0 0
+0 0
+0 0
diff --git a/challenge-128/abigail/t/output-2-1.exp b/challenge-128/abigail/t/output-2-1.exp
new file mode 100644
index 0000000000..d00491fd7e
--- /dev/null
+++ b/challenge-128/abigail/t/output-2-1.exp
@@ -0,0 +1 @@
+1
diff --git a/challenge-128/abigail/t/output-2-2.exp b/challenge-128/abigail/t/output-2-2.exp
new file mode 100644
index 0000000000..00750edc07
--- /dev/null
+++ b/challenge-128/abigail/t/output-2-2.exp
@@ -0,0 +1 @@
+3
diff --git a/challenge-128/abigail/t/output-2-3.exp b/challenge-128/abigail/t/output-2-3.exp
new file mode 100644
index 0000000000..b8626c4cff
--- /dev/null
+++ b/challenge-128/abigail/t/output-2-3.exp
@@ -0,0 +1 @@
+4