mirror of
https://github.com/wezm/advent-of-code.git
synced 2024-12-18 18:29:55 +00:00
Day 3 part 1
This commit is contained in:
parent
38b6af0f41
commit
c52761fb45
2 changed files with 400 additions and 0 deletions
300
2022/input/day_3.txt
Normal file
300
2022/input/day_3.txt
Normal file
|
@ -0,0 +1,300 @@
|
||||||
|
ZNNvFWHqLNPZHHqPTHHnTGBhrrpjvmwfMmpfpjBjwpmw
|
||||||
|
sbdzQgzgssgbglRtmjlwhjBlfrSrMt
|
||||||
|
zgsCRzJbsdRVQCDbcgLGWWLnZNGVLLZMNZnq
|
||||||
|
tvHhRtZGMvMHvfsrBBCTRbwbccRc
|
||||||
|
qznnlpzzDppWlDpQpCrcrwnBNwTZnBTZrn
|
||||||
|
PdVZJJqVZdllDPFtMjMgLjGMHvSgMF
|
||||||
|
csbhhVDDvzlVDcbccGGvfRjDHCjNLRHRCLfmnZfR
|
||||||
|
dFrStSTTmrrrHVfV
|
||||||
|
MMgQMMTMVTdgWtwTPwSgWSgGbbppJzlplvhBlPbzhlhbzG
|
||||||
|
FDJSTtSGhpPFDmFTZDpTFPmCBBrHqsCBhgBlqqrqrlRrHH
|
||||||
|
dQwMtfdzVwWfwctwnfnQCHllzRrsNzrrgNlCgqsr
|
||||||
|
fLfQnVjfwQfMdfvfnVvWDvtJPFGDpvZGbZpmbSPP
|
||||||
|
TzzCrJcDrTDdLDCJDvGNPCFqlZWlvNvWpq
|
||||||
|
RRHfjsQBFsjgjBQsWqGpNvZQqQlPPQPN
|
||||||
|
VnHBnRVssnnjsSfBwbMSrrbTwJTcwSDF
|
||||||
|
HJCgHCCFFFVGJWTlbqDdlqTDDpgl
|
||||||
|
cZccSmLrfZcrmmzSQftdpDtTHdbQTDMQ
|
||||||
|
NZZccrrBwZRPNNzmcLSSjJhGhVWCnsFnHBjGChsJ
|
||||||
|
qwwwJHTHqdFDtZBFPfFBZFzM
|
||||||
|
gVRcLnnWVgggnnnQgVWWNZtZrBfLBzZzBrMPPrZvPv
|
||||||
|
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TldgsRsslsljsRzTRjzns
|
||||||
|
rMcZcHcBQPvbbHGP
|
||||||
|
mSfmwqfmzrfHwFfmrwvPHqPmMFRlMDDZBCVVRCVZVlZpMRRR
|
||||||
|
TWjdTWhTsssLTGsJNWhTQddjRMDMtNNBSCDBllMMBVtDMVRZ
|
||||||
|
QhWTQcdhjThsdGbTLGjWHmffnmHwnwHrwqmmfcwS
|
||||||
|
LmrsMQnnpfmMLllvTvqvFFzvFHNN
|
||||||
|
WGRFVWdwZWZvCbJzcvJNzw
|
||||||
|
VjGhDtWGSFRGjVVSFdjjDPBfspPnnMBLPLrrpMMm
|
||||||
|
qqqCCJjtqtqCtqLZspHWBdSrWWSzzbzHFWBldb
|
||||||
|
GhwwcwPFVDcNFRRGwwzmlBrBWvllrvSzlrcd
|
||||||
|
DGGhQNNDhTpZZqqLQFQQ
|
||||||
|
QfZmgQQZCCMLfNrgprdNvvdrTg
|
||||||
|
hhttsBmBDcFRBlJshJcRrnjnTvNqpddNNqvndp
|
||||||
|
JtsGJGtGGJJJHDbctllhZHmMwMQSPVPzHSLMPZmV
|
||||||
|
DScSjZcNBZqjDDcLLfFtPfCfjfPvfv
|
||||||
|
pTmRlWhdMwTLGwCf
|
||||||
|
mRdWCVVglWrCmVHVrVCmdrbSzNcBDBqBZDNHqssscNzqNc
|
||||||
|
sPMHGFMsrPNCPnNS
|
||||||
|
ffJzllbzpZBllttBtfglgBTbSCVCmmrNFmmbFNvCFLLb
|
||||||
|
cpZqpfgZZJtJqJJJfWHWhHdHWHjcdRdFHD
|
||||||
|
ZZPfppvzMrlNBFcvFB
|
||||||
|
shJgstJwWLVJwcrFFVFrBVNNqFFB
|
||||||
|
HwWJdLHWWLcQgssHwwSQSQtQzCnZZMpZCmdzZCzpPzpCPRCj
|
||||||
|
QCpLRbsCCQQLbQzCBQDQBBfTTffWtTctJVRNVtnfwtWV
|
||||||
|
GvlqqlGlmMrdsvrhmlcTvwJtwNwTvfJfcWTW
|
||||||
|
lMhgqGhddjq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vBbGHv
|
||||||
|
HgvtDDzDpvwgvvqdHPZWdMssTTddSs
|
||||||
|
rJFrGNFVQmNFVmRnWhhsrTbhwhZTrdTd
|
||||||
|
VQGBBBVNQClpcBvBwD
|
||||||
|
PWlSzZGmdmGmlGmhggBpvMjvMjFgPJ
|
||||||
|
TtLRDtQQfTVcQQQRtBsJFFccFjWhJJFMBs
|
||||||
|
HqVCNtWHCDwdnlGwGqSr
|
||||||
|
RwdRJgCJRGGmdMbcGbdnTnTtttLLnptMtMtMqZ
|
||||||
|
DWsWPFrPqVPPLVCB
|
||||||
|
zQWWsslsQHFhDSszDSFQzJJJmvcgblRgmNvCJmvNgw
|
||||||
|
tpmFrWTtRpRTtggsSlnQpsnnlSHPsn
|
||||||
|
bZwZjNNZGLSrVsGndPPV
|
||||||
|
NvrcjCfbvvLBDBWfWFgRRm
|
||||||
|
WWFMgWmMhhwDcMMMDcmLWLtQwwsjbsQHvZHbRjZfsZzH
|
||||||
|
PTCplTCdSJJCpvPGNSvsbsfHtbQZzdHjQtjjsj
|
||||||
|
vNGJPpqJvJvqghgFgWFmLD
|
||||||
|
RlRpLTZCjWRjRWwpRsjHjbSbqMqMvvnbnGMnGGqQCq
|
||||||
|
gddfDNczmgPthNcDdgPVnbbzbnJrJJGSSVJJQS
|
||||||
|
BmDmcDmcmhffdBHlRwjRLpwlWQ
|
||||||
|
prQlfzlWRPzgQWzlMPMRppssHHsDsHjwnHHbWDwwbwjL
|
||||||
|
vFBJJtZNShJvZFtdSqtmqjTDVHVGDHbwVHDVsDnThH
|
||||||
|
vcjBZZdZqvCfpzRfcgRp
|
||||||
|
cggpqgRlSpNsgNggbjjj
|
||||||
|
ZZSSJVLVLFDZWNGjCWWbCjsF
|
||||||
|
vZLvfZQQfQtJVJDQShLrLfMmnldmwqwTqqMcMTMTndrm
|
||||||
|
bQBMtBPddtMFbJFhRGzMfzvnRGRSvWnW
|
||||||
|
TmHTqlVHwVpQqjmwGvSgSpnLpzfWGWSn
|
||||||
|
TTrDQCDrrTmDCCCVHHQZBdZFPdsNdFBtFDhtFB
|
||||||
|
fjpQvNZcGhGGTtQS
|
||||||
|
DVJzvbVmHbbtSTSTRStzTM
|
||||||
|
VDvmqllmJfjWlnplNs
|
||||||
|
ZmdHZJjvQLdRjpmLJrqqZBhhtCschPfBPcrDfPffCD
|
||||||
|
MWWSMMwnwlSgzWFFgSwzVwzqcfDCfChCbbtssbfDChcD
|
||||||
|
NMqFTwGqMwgwwgjHRdHRjdmQmQTm
|
||||||
|
TTqWPCWRhTWqPNjPJMNtrlbJFttQwwrBrlbwlc
|
||||||
|
GfpSDGZvpQffSHDgggDZrHctFmrHncnnwwbBtBrt
|
||||||
|
SQGfLsSLZsqMTRNMPT
|
||||||
|
HdBdnBZJTZBBmsfwwBlh
|
||||||
|
MjCVjzwqWrfzplzW
|
||||||
|
vVbqCjjRgjwMbnbGHJScScZHLL
|
||||||
|
dwwwtCdznvDDFrMrrw
|
||||||
|
GmWLQmgQmHgcdGcsTgTDqDbSfFWfMDMfbSNqvr
|
||||||
|
QhTLmVQHLmdLTjGGVptRnZpZBZVRpPpP
|
||||||
|
CzjFpzRHdtBFBCqNqSbJZWcQJTSbQjMTWZ
|
||||||
|
wGwVLlGrdVGwDnwsgfMSZvJMbWJcWlvbbMSc
|
||||||
|
rDfsgggrGnGngsPwdVLfDnmDtzzFNCPHtzCtFHpBRqhPztzR
|
||||||
|
mrgWzBcDtVCcQcCCdscf
|
||||||
|
LRJhjRjPZvqSRGhGjLgMCdHpMNwQCpMHpHMS
|
||||||
|
GRvGJRJjqPZbvGGhRjnqLJWtgFgtzTzDrFnTWrlTlllW
|
||||||
|
cbmcddlffvbTfvFflpZzsMVNznNVlnqnzqHMNM
|
||||||
|
StWJBQRWLRWNPNMCswRVHC
|
||||||
|
BJQBhSWhjSthJQGGWWggJDDDfbdbbfHbddbrFrddvFvv
|
||||||
|
jFqvqvWZWDtBJrrlrq
|
||||||
|
TzGcbHcrmVzMGNSmTcGDtBthJCNtsJDlBCghgP
|
||||||
|
bTrnTccnLSrrTHbnwfLjfdvRRwZFdwfR
|
||||||
|
drHVrdVDfsDbVsdVDbVqRwbZZwCRCCCJlJThwRgT
|
||||||
|
jFPcFpBSvtNPzSFcjcQpcQjpThZCRltGRRRJhwCwGhwgwhRm
|
||||||
|
SQSzPBjjPPSvLqqssdnqLZLMsM
|
||||||
|
bQTWlWlvQclNwwWlCCLStCRSSjStpj
|
||||||
|
zVZZDdBnBmgzVsjsLthSpshdCL
|
||||||
|
DfBnrmBmgzHBfDHmnGrNFCwQvTPvqCTwqTFGbF
|
||||||
|
srSWJnrbmlWlbhzsWszSvPGwvgDhcjdjjfvhjvGv
|
||||||
|
BRRQFLtNfQNMpqpQHDjdDjDcZZcvwZZHPH
|
||||||
|
NLCNCtRQfRttRFRCTqMBqQQrzrbzrlJmVVbsSWmVrTbSzJ
|
||||||
|
RHLfLcSRTFSghLRHGbwZmMZddgJswZsbMm
|
||||||
|
ptqjtCzzQztqCjDlBGpDpbMZdwmMbZsdwNmdJpbs
|
||||||
|
tttzCVllDCtDQnQBVHGHWvWTLWcLSLHf
|
||||||
|
FVlNnPqbGTHftghggJqf
|
||||||
|
zLcZWZpWWrcrZLLZDWrwMcrhBFBttChBmBgptChhtFftmf
|
||||||
|
LZZLrDrrDDMrcwrDwsWFzdTlnGQPQQVbdbnsvnvsVQ
|
||||||
|
BbPNMJNbQvDbvPLwHflczlwwzf
|
||||||
|
pZjWZGZjFGdgpnVgZhghdmcflrlswzzcstlrLwhtwc
|
||||||
|
WZSdqFjqSqSWdGFjZpdMTTDNTvLCRRLLqRQMCN
|
||||||
|
FqgFGtbgTvRwrLqhvw
|
||||||
|
JCCWJWCdJMQNNsSWsMPQRDDLDSDLwTrrvnwfDvnD
|
||||||
|
HdPJlBBHCCQdBMWdTtVbgHczGVGjmtzG
|
||||||
|
PLlZDLZDsFCvbDQv
|
||||||
|
HVcTmVmJqVzqczfzbjvvCFMRfCsWjMvR
|
||||||
|
cqHzTqJ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ldWZzMzWmvjrjprLRFjRVvvff
|
||||||
|
tCzVzsVtDFzssnSsgdqJdCNqJhmgmpqq
|
||||||
|
PZccPGvQfRLMQwNdhpwhNh
|
||||||
|
jLrcbRjPZBrcPdjRHFlWnVtBFslSWznW
|
||||||
|
vvvbJbWrLvFWHzZzZRhB
|
||||||
|
chtwTmCNlRRZzRPT
|
||||||
|
hmcCssCswrMDGMSrsr
|
||||||
|
LStGBsQLlllhzMzs
|
||||||
|
dzVZDNWRDdZNDTZTPvWVhhphpMlfMccRmfnlMlRn
|
||||||
|
VFvgTrNPdFWNNFNFTzTFFSjSQBCqrtQwSBGLLBGwGL
|
||||||
|
qGJSJhWStdSfWvSvtGRRnzRDDggrgvnzsmRP
|
||||||
|
lTTLpcljjGlLlLNBpjwFQDQmRnrRDPrPscRrDDng
|
||||||
|
NCNjFlHNCTVjpwGqGSVbJddqZZJM
|
||||||
|
MbWdgvHFlMvmzTzShvmm
|
||||||
|
tqjqpLsNsrrsjstNLpQrGVhVBzrhVcfmchDcTPVVmc
|
||||||
|
RqwjqjqsGjjGGQNjGpQZpqRFJgmMHwdbFWgnHMFdwmmCFW
|
||||||
|
HHHLcCcVHjTHglsB
|
||||||
|
wDSRwzzRpMSdNSPSwSpRbqvgBsdqlgTvBFBjgFvvgB
|
||||||
|
RpbzPssDMWwNRbRNRPDsDhJthLQVGLJcctQCJQfQJCLm
|
||||||
|
WsZgbNgZVCCWbVVVmgZbCCRPccGnzPBqJjzWJBJPzvBvGz
|
||||||
|
SpfThHtrHFBPPzJvPntj
|
||||||
|
QHDhhrhpTQpHhQHnfwnTCNlbZCCDLNllZlVsNCNl
|
||||||
|
QtzJFRQLMRnZcZsfcphlPQ
|
||||||
|
qSBbjmWSCNmVldSqqSqmjCSZshfwfrPPZZfcPVZfhgsgPg
|
||||||
|
HqBbHqBGSlNBbltnLLHFJMtRvRTD
|
||||||
|
tcGtDdMcttttHNBlMctldlwjwwqqCLCwDwZjFCZhmnwC
|
||||||
|
VrJgv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vNbvnNMFHHRVVbR
|
||||||
|
CPShbbdlGCdQqlRPGPdlDWDFzjtFjggCDJgWczfF
|
||||||
|
mrHrTrrBMBsmNsrwsBpnfpggDDcjjDDpjzFJzzjtJz
|
||||||
|
BvsNvBLHrrrNvwBTNNsNGbdQhlPGGfqhhRGqLGdl
|
||||||
|
PSSlPtlStGhPNMtwPMPJzDddnbnDNTDDnJqjbz
|
||||||
|
FFVHRwVLvFvVrVHrZcLmRHggjDmdDnDnznnznzQjzdmJddbn
|
||||||
|
WrvgRgcRcRrrcRvgcVrHVrwCCSfsCsGsllhMSSSSMttlSCpG
|
||||||
|
hBPJqVZTqqPSlGlfddfddZvl
|
||||||
|
JWWMJCpnMrmztzdjnzld
|
||||||
|
RbWsrwMrpbRspbWgpwhLJPccNVqLLPSVgVPV
|
||||||
|
hcTrWqcfhwGfWrWMjHjGvDHPmJMDzF
|
||||||
|
ZtlsnZZtLBSbSssnbndjDJJFHFHJPHPsHMTHHM
|
||||||
|
ntRZtSbtZgZStTqchwQfRwNpcq
|
||||||
|
GfLqrsqQGgPgjjQGVcNvTpTpNFcWPvPPpT
|
||||||
|
bRnRLnMZFdCMcpvT
|
||||||
|
RnRhzRlmlhhHhhmhRsqLrfzrGVSrGBSGrL
|
||||||
|
fbMffwdZsncrGcfG
|
||||||
|
qDBjSSLqhLBSmDbjqNhqTLjCGrCHGrvcGWcpWcrGWnCrpm
|
||||||
|
STLDqbhTLqNTNSRhlwZlJlRQFFRwMdPQ
|
||||||
|
TVVGNFggcjPPJzwvQlRRwRvSlcSc
|
||||||
|
frsBbWhtSRzSLfRf
|
||||||
|
qDCqddbsWrqzhsdNmdJNJHjTggFFVV
|
||||||
|
NTWTDrSdFTLtPTGf
|
||||||
|
lZqjHlVRvRltLtRWFMtFLL
|
||||||
|
qvjWzzvVbZpjqllggscdchwDrCphwsdhrD
|
100
2022/src/days/day_3.gleam
Normal file
100
2022/src/days/day_3.gleam
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
import gleam/int
|
||||||
|
import gleam/set
|
||||||
|
import gleam/list.{map}
|
||||||
|
import gleam/string
|
||||||
|
|
||||||
|
type Rucksack =
|
||||||
|
#(List(String), List(String))
|
||||||
|
|
||||||
|
pub fn pt_1(input: String) -> Int {
|
||||||
|
string.split(input, on: "\n")
|
||||||
|
|> list.map(string.to_graphemes)
|
||||||
|
|> list.map(split_in_half)
|
||||||
|
|> list.map(common_item)
|
||||||
|
|> list.map(priority)
|
||||||
|
|> int.sum
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn pt_2(input: String) -> Int {
|
||||||
|
todo
|
||||||
|
}
|
||||||
|
|
||||||
|
fn split_in_half(l: List(String)) -> Rucksack {
|
||||||
|
list.split(l, at: list.length(l) / 2)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn common_item(rucksack: Rucksack) -> String {
|
||||||
|
let one = set.from_list(rucksack.0)
|
||||||
|
let two = set.from_list(rucksack.1)
|
||||||
|
let inter = set.intersection(one, two)
|
||||||
|
assert 1 = set.size(inter)
|
||||||
|
assert Ok(common) =
|
||||||
|
inter
|
||||||
|
|> set.to_list
|
||||||
|
|> list.first
|
||||||
|
common
|
||||||
|
}
|
||||||
|
|
||||||
|
// Lowercase item types a through z have priorities 1 through 26.
|
||||||
|
// Uppercase item types A through Z have priorities 27 through 52.
|
||||||
|
// I can't find a way to get a codepoint or match on a range with Gleam so this
|
||||||
|
// will have to do.
|
||||||
|
fn priority(item: String) -> Int {
|
||||||
|
// case <<item:utf8>> {
|
||||||
|
// <<a:utf8_codepoint>> -> a
|
||||||
|
// }
|
||||||
|
case item {
|
||||||
|
"a" -> 1
|
||||||
|
"b" -> 2
|
||||||
|
"c" -> 3
|
||||||
|
"d" -> 4
|
||||||
|
"e" -> 5
|
||||||
|
"f" -> 6
|
||||||
|
"g" -> 7
|
||||||
|
"h" -> 8
|
||||||
|
"i" -> 9
|
||||||
|
"j" -> 10
|
||||||
|
"k" -> 11
|
||||||
|
"l" -> 12
|
||||||
|
"m" -> 13
|
||||||
|
"n" -> 14
|
||||||
|
"o" -> 15
|
||||||
|
"p" -> 16
|
||||||
|
"q" -> 17
|
||||||
|
"r" -> 18
|
||||||
|
"s" -> 19
|
||||||
|
"t" -> 20
|
||||||
|
"u" -> 21
|
||||||
|
"v" -> 22
|
||||||
|
"w" -> 23
|
||||||
|
"x" -> 24
|
||||||
|
"y" -> 25
|
||||||
|
"z" -> 26
|
||||||
|
"A" -> 27
|
||||||
|
"B" -> 28
|
||||||
|
"C" -> 29
|
||||||
|
"D" -> 30
|
||||||
|
"E" -> 31
|
||||||
|
"F" -> 32
|
||||||
|
"G" -> 33
|
||||||
|
"H" -> 34
|
||||||
|
"I" -> 35
|
||||||
|
"J" -> 36
|
||||||
|
"K" -> 37
|
||||||
|
"L" -> 38
|
||||||
|
"M" -> 39
|
||||||
|
"N" -> 40
|
||||||
|
"O" -> 41
|
||||||
|
"P" -> 42
|
||||||
|
"Q" -> 43
|
||||||
|
"R" -> 44
|
||||||
|
"S" -> 45
|
||||||
|
"T" -> 46
|
||||||
|
"U" -> 47
|
||||||
|
"V" -> 48
|
||||||
|
"W" -> 49
|
||||||
|
"X" -> 50
|
||||||
|
"Y" -> 51
|
||||||
|
"Z" -> 52
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue