aoc

Advent of Code Solutions
git clone git://git.alexkarle.com.com/aoc
Log | Files | Refs | README | LICENSE

commit a5eb8e8a08568cfbad6415643307fa2b83d30a7c (patch)
parent 8500c8a46fe77c06d2a0295e845c4ca7a987e6f9
Author: Alex Karle <alex@alexkarle.com>
Date:   Sat,  3 Dec 2022 00:41:29 -0500

Add day3 pt 1

Diffstat:
A2022/03/input | 300+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A2022/03/sample | 6++++++
A2022/03/sol.scm | 42++++++++++++++++++++++++++++++++++++++++++
3 files changed, 348 insertions(+), 0 deletions(-)

diff --git a/2022/03/input b/2022/03/input @@ -0,0 +1,300 @@ +QLFdFCdlLcVqdvFLnFLSSShZwptfHHhfZZZpSwfmHp +rTJRjjbJTgzDJjdsRsfwtfNwtfmZpZNhmmzt +bMdJjsjglnVMFCCc +BZvZMBBBMTtZTgcCPdgtgQCrrV +VspNDDpsGDGnRmRpRplQdrrPcPCjgDCcPQCQQj +RVnsmspnpwFRlHGRwHHlnRSThSSvBTbFTZMqTMZMTZFh +ttffrVJWtWpgtQnZGVnNSLTHSZ +jRsjjmhdRcjcRsFcdwGLMZSnHMTSMNZN +RjczlvjhPCcPjcvRpbglWplJBblqrGgq +NwCWwdNQNDCwGpWNQwmJtZgPZrdJgLZcPhLddr +blqpnFTqrLbcLPtV +MnjqSSpqlFRvSqNDGHvWHQDwfWmm +jfLljlQhDLmlrMJQtJTJrQqQ +NpBbjjsdMCgCCMrb +dwspwGnSHHGsGzDDlFDjVWjfZWnP +wQhTZwvpZFZdqWLnnwSrWC +mfDmMFlDcPLdgDSCLCqg +PmzclsMclMlFsHHsJZFHpT +LfLJWNdJnBLfhndfWdZqcgDZgSqgCCSSSLDF +bQVQmrrjPqQDZSZBCQ +RRtGjVmRsPbPrrnNNpNHHnBnpHns +PfbGNwGBwNcPTbGNQFBVjsjztVztVjHV +hrdCJhmlJhZrLDRmghrmDrzqFsbgtbHqnznzznQtbjtz +WdZdDJ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rqrCRrwGPGmmDGmbpBGNpNNgg +CRMjwsjwsLdLRrQFJSvMFMWZcHFW +JgJJPvtrhRPQQzSRMQFFSF +BLqsjsdLsMBqblnsGbBqVqdwSQSCSWwNFwczQWCNNwNCHn +ljqbpLbbdDlbDbqDDVtMttTTgpJJgThhJrJr +nflndmjbSnlTQGwvWGPHGRGj +NtstcMcDJMvwgHfFvDgR +qqqpLrMsLLqLNNnzbrdlbZSrznfz +ttZCCFjNjnPVCFQPPFbbStrzqzqrrrcwtmJJ +gTTMRMTWsTGGTddHTTbBzBLSmqbbJGzGmqqb +HpgpMTvRhHHTRDhMsHdHDRhjJlVPJjNFJnnFpQQVfPCjnP +VqJVQPpjQqPBbHwldmLfVVmd +tMGvrzzDGCDDddwLbgLvLwcm +TWDWCzTZDGMZtzWWtsFhbRRqRQRjhbNQBBTh +zgLgLHnnzCCvnsHSsZBZBsTRdD +rslllhJjcQNNGjpWJlSRTRdwBVSSNTPVSdPB +jGrGqjJfqccrfqGcGplrJpFvzggqmCtMzmsMnvMvvCgm diff --git a/2022/03/sample b/2022/03/sample @@ -0,0 +1,6 @@ +vJrwpWtwJgWrhcsFMMfFFhFp +jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL +PmmdzqPrVvPwwTWBwg +wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn +ttgJtRGJQctTZtZT +CrZsJsPPZsGzwwsLwLmpwMDw diff --git a/2022/03/sol.scm b/2022/03/sol.scm @@ -0,0 +1,42 @@ +#!/usr/local/bin/chicken-csi -ss +(import (chicken io)) + +(define (prio c) + (if (char-upper-case? c) + (- (char->integer c) 38) ; #\A -> 65 - 38 = 27 + (- (char->integer c) 96))) ; \#a -> 97 - 96 = 1 + +(define (append-if-absent x lst) + (if (member x lst) + lst + (cons x lst))) + +(define (bisect lst) + (let ((len (length lst))) + (define (bi lst a b) + (cond ((null? lst) + (list a b)) + ((> (length lst) (/ len 2)) + (bi (cdr lst) (append-if-absent (car lst) a) b)) + (else + (bi (cdr lst) a (append-if-absent (car lst) b))))) + (bi lst '() '()))) + +(define (score-pack pk) + (let* ((parts (bisect pk)) + (l (car parts)) + (r (cadr parts))) + (apply + + (map + (lambda (x) + (if (member x r) (prio x) 0)) + l)))) + +(define (main args) + (let* ((lines (read-lines)) + (packs (map string->list lines)) + (scores (map score-pack packs))) + (print (car packs)) + (print (bisect (car packs))) + (print (score-pack (car packs))) + (print (apply + scores))))