From: Jan "Yenya" Kasprzak Date: Sun, 4 Dec 2022 05:11:25 +0000 (+0100) Subject: Day 4: 2nd part too slow X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=bc1c88feeec88f3b0c9b3536ba2cce7d8ea1df1b;p=aoc.git Day 4: 2nd part too slow --- diff --git a/2022/07.pl b/2022/07.pl new file mode 100755 index 0000000..a0a237e --- /dev/null +++ b/2022/07.pl @@ -0,0 +1,14 @@ +#!/usr/bin/perl -w + +use v5.36; +use strict; +use experimental 'multidimensional'; + +my $count; +while (<>) { + my @r = /\d+/g; + $count++ if $r[0] <= $r[2] && $r[1] >= $r[3] + || $r[0] >= $r[2] && $r[1] <= $r[3]; +} +say $count; + diff --git a/2022/08.pl b/2022/08.pl new file mode 100755 index 0000000..c7f9131 --- /dev/null +++ b/2022/08.pl @@ -0,0 +1,16 @@ +#!/usr/bin/perl -w + +use v5.36; +use strict; +use experimental 'multidimensional'; + +my $count; +while (<>) { + my @r = /\d+/g; + $count++ if $r[0] <= $r[2] && $r[1] >= $r[3] + || $r[0] >= $r[2] && $r[1] <= $r[3] + || $r[0] <= $r[2] && $r[1] >= $r[2] + || $r[0] <= $r[3] && $r[1] >= $r[3]; +} +say $count; +