From 375169efa68219af7e53ab24b10cfb8e5ee988ab Mon Sep 17 00:00:00 2001 From: Andreas Grois Date: Fri, 19 Dec 2025 22:20:34 +0100 Subject: Day5 --- day5/any.TXT | 8 ++++++++ day5/day5.any.92f | Bin 0 -> 103 bytes day5/day5.init.92f | Bin 0 -> 102 bytes day5/day5.part1.92f | Bin 0 -> 359 bytes day5/day5.part2.92f | Bin 0 -> 813 bytes day5/init.TXT | 8 ++++++++ day5/part1.TXT | 24 ++++++++++++++++++++++++ day5/part2.TXT | 44 ++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 84 insertions(+) create mode 100644 day5/any.TXT create mode 100644 day5/day5.any.92f create mode 100644 day5/day5.init.92f create mode 100644 day5/day5.part1.92f create mode 100644 day5/day5.part2.92f create mode 100644 day5/init.TXT create mode 100644 day5/part1.TXT create mode 100644 day5/part2.TXT (limited to 'day5') diff --git a/day5/any.TXT b/day5/any.TXT new file mode 100644 index 0000000..efac786 --- /dev/null +++ b/day5/any.TXT @@ -0,0 +1,8 @@ +\START92\ +\COMMENT=Single file dated Fri Dec 19 22:12:56 20 +\NAME=any +\FILE=day5.any.92f +(s) +when(?s,false,true) + +\STOP92\ diff --git a/day5/day5.any.92f b/day5/day5.any.92f new file mode 100644 index 0000000..4db287d Binary files /dev/null and b/day5/day5.any.92f differ diff --git a/day5/day5.init.92f b/day5/day5.init.92f new file mode 100644 index 0000000..35f74b0 Binary files /dev/null and b/day5/day5.init.92f differ diff --git a/day5/day5.part1.92f b/day5/day5.part1.92f new file mode 100644 index 0000000..338fcd5 Binary files /dev/null and b/day5/day5.part1.92f differ diff --git a/day5/day5.part2.92f b/day5/day5.part2.92f new file mode 100644 index 0000000..a2cb050 Binary files /dev/null and b/day5/day5.part2.92f differ diff --git a/day5/init.TXT b/day5/init.TXT new file mode 100644 index 0000000..70d7b7c --- /dev/null +++ b/day5/init.TXT @@ -0,0 +1,8 @@ +\START92\ +\COMMENT=Single file dated Fri Dec 19 22:12:59 20 +\NAME=init +\FILE=day5.init.92f +(l,n) +newList(l)+n + +\STOP92\ diff --git a/day5/part1.TXT b/day5/part1.TXT new file mode 100644 index 0000000..9dca82a --- /dev/null +++ b/day5/part1.TXT @@ -0,0 +1,24 @@ +\START92\ +\COMMENT=Single file dated Fri Dec 19 22:13:02 20 +\NAME=part1 +\FILE=day5.part1.92f +(rs,vs) +Func +Local lowerb,upperb,dimb,dimv,i,t,result +mat\to\list(rs[1])\->\lowerb +mat\to\list(rs[2])\->\upperb +dim(lowerb)\->\dimb +dim(vs)\->\dimv + +0\->\result + +For i,1,dimv + init(dimb,vs[i])\->\t + If any(t\>=\lowerb and t\<=\upperb) Then + result+1\->\result + EndIf +EndFor +result +EndFunc + +\STOP92\ diff --git a/day5/part2.TXT b/day5/part2.TXT new file mode 100644 index 0000000..790c74a --- /dev/null +++ b/day5/part2.TXT @@ -0,0 +1,44 @@ +\START92\ +\COMMENT=Single file dated Fri Dec 19 22:13:14 20 +\NAME=part2 +\FILE=day5.part2.92f +(rs) +Func +Local i,j,lowerb,upperb,dimb + +mat\to\list(rs[1])\->\lowerb +mat\to\list(rs[2])\->\upperb +dim(lowerb)\->\dimb + +For i,dimb,1,\(-)\1 + For j,dimb,i+1,\(-)\1 + If lowerb[i]\>=\lowerb[j] and upperb[i]\<=\upperb[j] Then + lowerb[dimb]\->\lowerb[i] + upperb[dimb]\->\upperb[i] + dimb-1\->\dimb + Exit + ElseIf lowerb[j]\>=\lowerb[i] and upperb[j]\<=\upperb[i] Then + lowerb[dimb]\->\lowerb[j] + upperb[dimb]\->\upperb[j] + dimb-1\->\dimb + EndIf + EndFor +EndFor +left(lowerb,dimb)\->\lowerb +left(upperb,dimb)\->\upperb + +For i,1,dimb + For j,i+1,dimb + If upperb[i]\>=\lowerb[j] and upperb[i]\<=\upperb[j] Then + lowerb[j]-1\->\upperb[i] + ElseIf lowerb[i]\>=\lowerb[j] and lowerb[i]\<=\upperb[j] Then + upperb[j]+1\->\lowerb[i] + EndIf + EndFor +EndFor + +sum(upperb-lowerb+1) + +EndFunc + +\STOP92\ -- cgit v1.2.3