feat: day3
Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
parent
8427087485
commit
603f05ef5e
@ -13,3 +13,8 @@ day-2:
|
|||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- cd day2; cargo run --release ./input
|
- cd day2; cargo run --release ./input
|
||||||
|
|
||||||
|
day-3:
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- cd day3; cargo run --release ./input
|
||||||
|
8
day3/Cargo.toml
Normal file
8
day3/Cargo.toml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
[package]
|
||||||
|
name = "day3"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
300
day3/input
Normal file
300
day3/input
Normal file
@ -0,0 +1,300 @@
|
|||||||
|
VdzVHmNpdVmBBCpmQLTNfTtMhMJnhFhTTf
|
||||||
|
FgqsZbqDDFqRrhhJnsnLMTfhJG
|
||||||
|
bRRRPrRRwSwbDqgjvDZbRbQzpzmQVWCzzBdvQBFCzlWV
|
||||||
|
GcDdRdvhRssRhGDdShCRtqWjlQzqWgqzNfNjfQWWjt
|
||||||
|
mwwnnPFwmVrPmJmzfNzqCjQCbgVlgC
|
||||||
|
nPnHHLrHwmJTrCTJpThBscBSdSLGZvZBvRhZ
|
||||||
|
RVQQcVlcSRclfZCCCnMJJTSTnC
|
||||||
|
NdHwjdwjbBBZrrZrbJDZJJ
|
||||||
|
wmhjGGBGwwmjtjtdPlfRcpVQlhRppVJF
|
||||||
|
pplbNBPPrppllrFNbpvppSTcwqcWFhTTShhJDTchqd
|
||||||
|
RGzRfLjjmZmfmwLftTWhStStJWTdWmDm
|
||||||
|
nfsMjQssnpPvNnrPrw
|
||||||
|
SjjBgllzlQjBZvlBBgcFbgJHsMhJqbMHPggJbM
|
||||||
|
hRLRVDdRRWnJqnnHTqMCnH
|
||||||
|
GRfLddRRpVhNVrWSjwQQzSzcGSBQSc
|
||||||
|
qMwNqqBdQdnTVBBVVhMVnVFzTHPggTPjGRDzvPTjjmvPDj
|
||||||
|
sbSrWJpStrtPtRPttzmmDD
|
||||||
|
pfbJJcbsrcLpWLllsnFmcqcwQncnQQqVNQ
|
||||||
|
RBTWCMwCwdZThPZcZZ
|
||||||
|
pVmVpHLFFFHHVgVmvNmHSQNvddlPPzZJMPcdhclhjczLdZMP
|
||||||
|
vnnNnFStGMRDwWnn
|
||||||
|
fWDdJTpDJzdBBBdmDSbSRHRwPqbPbHgSbz
|
||||||
|
slQtQvNsMVvrrgPRgRglnhwWPH
|
||||||
|
sGMMQFrsjvNMfWmdpfFDFZBf
|
||||||
|
vnMRMWCMJwWWwwWPjmSdVmLdzvVbLrhL
|
||||||
|
HsNfDHQlZpNqfQzbLbrqhjLmVdjd
|
||||||
|
dfDZQsNpstHHHptZDDtZWgngtgBMPMMRwCPtBBGW
|
||||||
|
HwQwwbwFNWHwHBVFQFLQzRznZnSzcjjjpPbcPpSP
|
||||||
|
vTfTJsCmsftJZmTSSdPvzdjRSvPdjd
|
||||||
|
TrGtTJfmGDfDhrhJJJsqrZhDBFLHHLLQWFwwlWBVBBVwgLFD
|
||||||
|
FFTJRLccQgmTbSsbGm
|
||||||
|
PBPPqCvCwqwhQQVhQngmVmSgglmGnHbnmb
|
||||||
|
zqthvtQPBfCCzPwQPtwQzPwNLfNRFNLdLRLFRFFNLFdFdW
|
||||||
|
nszjQnsPwjznzCCrhJqvjqhmBv
|
||||||
|
tFWdHGWFGtctlNNpZBBhmqTrrbWqvTBT
|
||||||
|
dlFtcpHDVVVHFdNGHGpGfQgsPDzSMsQwwPwgLLBQ
|
||||||
|
TzQqTJGvnnSzqrWTnvfbbcflQcVltfcCMPVM
|
||||||
|
jFjNZFFJLpFwmBwblcpptcVtfbbVlR
|
||||||
|
jmmJdBBLNdGDWDDrdzqn
|
||||||
|
pzddqQmGgbqgGpbJmmdnLZDCRZnZvFlLRZLSlLRT
|
||||||
|
rVwchcBBMwVBHhHTZCTSGSCRTZlTDr
|
||||||
|
HtccPfjfBhMtVBGHWpNqJdJdpjNJppWz
|
||||||
|
WThTWWhtPbZRvvWbbvRTSRMjVRLLgFssgLpVsfSF
|
||||||
|
JdwrlJcCwfzdqwwjsjzpLMgVsMFgML
|
||||||
|
lQrwHNGJHClvTmfhBmPQmt
|
||||||
|
lbRLhcLRpLJzgdGddF
|
||||||
|
qvhwqDDCVtBDVhfMVGFnzGGzTBnGzGGgFg
|
||||||
|
VjCwCWCMtjVDtChvQhtffcSmHpNWrrcHZHHZpplWbp
|
||||||
|
DJVDVdvpmZdPgrCbgbgCJC
|
||||||
|
lzczcWwwznGhBgPSvTlCrNgqNC
|
||||||
|
wGzzQhzGGsBBGRBcQwGwnwjmmRHpRfmmMpppMjjHDvLL
|
||||||
|
HJjJQWjFmmWtFmJTMchghhDwNMhVMWML
|
||||||
|
SznPSRfRSSPdrrPSShbDVhbLPwcwGGwVNh
|
||||||
|
ddRfzdRrCrRsZDSnFjspvFvqFqFqTvJt
|
||||||
|
lflfjQfjvljfbfMLTTDCmHNLNVbL
|
||||||
|
HSJnRrrJZJssnGRrnsrcqqRnDCLBMhVCTLVLhVNVJBBBhhBm
|
||||||
|
SsrGGqqnSsWSnnqWHSrPfzftvFdvWlwfQgQwWvzz
|
||||||
|
nQlsGnFGwwqNJWmJJjpplt
|
||||||
|
HMTLPTRdvsTCCThDCZdLdLDNNpJBWJbjJMpBmbtNptBWmm
|
||||||
|
DLCzPzTzZDdLdGSGfSGrsnQGzr
|
||||||
|
LNPPLHNPHQNQSBFDWDPgggFv
|
||||||
|
hszfWCWJhrBMsSSBgvFD
|
||||||
|
GGZjfmJTjmZfrJrZrZJRGwNQnlLNHWjLVjlwdVNHpV
|
||||||
|
BdNVdTcGVclmTwrTnwPwrHCr
|
||||||
|
zttBWzfLsCggHPwDrf
|
||||||
|
szsWSMbWzzbqBbzJjtjsvMzzvdmdVpGllpcRNZZhmRpZcGGc
|
||||||
|
CjdbMmmmZFnzzgHlttGBVqtBGtsldG
|
||||||
|
LvPPWNcFSSRslWhBsllT
|
||||||
|
ppccvLPpcSNwLLwrDNNpLvwJHCMDmbCJbFzgmZZmFgbgnM
|
||||||
|
TTNRwZqhcTTjsNTTsmrJlvrmmmqqHSrlJH
|
||||||
|
fLQCCdtcfCDDVbVVQdFbQbdJHMHrJHrHnMllHdMHPrMdln
|
||||||
|
WfQLQWWDbwRTWcRssN
|
||||||
|
HQGQWHPDHNjMNQGNWNTWCvZllzqFZqzvvzhCtvFj
|
||||||
|
DfgwdgfcFpchztvt
|
||||||
|
sRggdwwVdgmnSTnnDBPBNWLn
|
||||||
|
WbCZCfTVTTJjSwGdWNDGGw
|
||||||
|
MMRqggMsqhlmlhrssHgRnRmRvdzdczvdNGNLzScGDrNzrLNc
|
||||||
|
lRqsnRhmqqQnQpgQMlgDqRfBTJVFbJZQtBCbZQJVZFFb
|
||||||
|
JnhQcCnmLDsmgmgr
|
||||||
|
bbMZppRFGGRPfBMMRGMZssTTrLlLfsLlVLdsLsdn
|
||||||
|
GZGSpPGMZtGGPFFRGBCwhvwjjcnJctvQcvHq
|
||||||
|
vvrPrHZMGJNRMnqn
|
||||||
|
BVChWWcDVWsBwCWwGrJNhRLJJnJtLqnq
|
||||||
|
cjDfcfpWWsfWccBsHgPgrPTdpZbbgggv
|
||||||
|
GshtVtVtjSCVtVvVGtlVvFZLMvLRZmHmZwbLwZdLdZmR
|
||||||
|
JWzNDQzjcgJgQBJgzgMwLLHZZcdPwRLwRdHZ
|
||||||
|
QWTppBWfDrrNBTTfffhFCpVSjnhCGsFtsqSl
|
||||||
|
nmbCnzHHNzCjCJHJNSCWHLBLrvBrrSGRBDhrDRLrGL
|
||||||
|
TVtPllwcgdmTRhLQTQhT
|
||||||
|
fdFtccFcpPmggfdfNzHzCMsbCnWnJs
|
||||||
|
fMgddvjgRRvjvjVJVdTlZGGtGnrlnqTccNjl
|
||||||
|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HMgpPMp
|
||||||
|
NJlNSSMLDfJfmlSqHZRNpRqNBRPRPq
|
||||||
|
LlMmJfvDVVTJSmVMscsCFtvwcjWjrjCj
|
||||||
|
NVVMGWFSMRVGWSthwhTJWzcJCcJsTs
|
||||||
|
jqRLqlfRZcmjcCzT
|
||||||
|
rlRRrdrflpdvPbHpflfPlfDBgBMQpGVQMgpVDGMggBDV
|
||||||
|
VwRhccRsnQStRhtGQVQVsmjgDgqJdggDjqLDgJlLzmLl
|
||||||
|
BWFZpWHBNCBCNBzBNvWBpzHZqqlMqgNdlllDdqDgJDLlfDdd
|
||||||
|
pFbTrrrBzbzTtSwStQnnsrVn
|
||||||
|
DRfFbFqzbddfPFtsJnJRsnClJRsn
|
||||||
|
cgjgQgWvSLVQgmWWgWVjVSSSBTltThLnqJssnTCZsTThntZT
|
||||||
|
qjwpSrmWgcSrGMfdFDFdwHFd
|
||||||
|
RWjDDWDjDNjjgDtSRRgjcjzFpnzwdFbFNdbFbpnldwFF
|
||||||
|
vQfPfTQJbZdThTzL
|
||||||
|
PrBQJQsfQqrrbfmPqMBfJbggjRVgWjttsHRSgRctDjSs
|
||||||
|
NgqNWqqWWdnJdqpBNFtCmJGCDHttDGDsHsHm
|
||||||
|
BjvzhRLTrTBQhTMQRjRRcjPGtmDCZZDZSCmmMSSZmVmSSt
|
||||||
|
vQzRvRzQcPcvfQzRnddppFgnFfWwBFlb
|
||||||
|
nnPvfvgrtPDHgvvGTRRRPZQGpGCLLV
|
||||||
|
FlBsBdbllFdfWpbGMCVMZLVbZQ
|
||||||
|
lhchNcqFsJBlBszztvwHjvzgrzmzffgH
|
||||||
|
zZhdjTpJJpjmmpPZhvqnnZHqZcggvgMbgv
|
||||||
|
tFpFQFSFtBGlFNwFfNMnHfbHcnvcvcfvcqrM
|
||||||
|
GBFlNLSNVGVSSGtQSLLBBlNtphDdzpmmPmTPhRmdzdVCCDdR
|
||||||
|
rpRCCDLpmnCdJCjn
|
||||||
|
vMhSFvgsMGLmnmW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FFFLmbmTTBnFB
|
||||||
|
fGpcccNNqcctqGMprvMPmbbzFSflSRzPBBlBbS
|
||||||
|
JCjnjTZTTGPSGmTFPb
|
||||||
|
ZWHhJjHLDVDgHLLDGjnhctsstwqctNwWqNwwQrtv
|
||||||
|
sDwQhcwhBDDwrhGsQnRBQHHMHHMNJMZFCFRbCRftMM
|
||||||
|
zjjlmjqfdTqlWdzTqmLzlzVjNCHJNHNFMFtbJNZgVNMMCCtN
|
||||||
|
vPTfLmPTLWBsPDnSscnS
|
||||||
|
ngznwDPPTzhPPDCTQnTTDQBQqHNNrHFVppbbjRFFqFhHqRqr
|
||||||
|
tZJtcGsGtLLcctRqVBbbqrspbHNq
|
||||||
|
BmZSvGBMdWPzMPgnnz
|
||||||
|
MpNWPVNWWZWVVNZHVcvJjgBjJMStMJSjjg
|
||||||
|
rzdCzrCTTLRCslvJDSjjdScgDm
|
||||||
|
RLhCQzqTCssThRQzRzwGQrrCFffbfWppNpWNWVcHqZbHpVPp
|
||||||
|
zQzCVWdSSjCdjpchWcGftflGZcgG
|
||||||
|
RwnJTJwmvFHTBFmtBccZZfBGMstllM
|
||||||
|
wwvvHRwqDnHFrmqnrSbQVVQfSbqQjbqjbQ
|
||||||
|
ttDftStSlftPgSHmJbFwnMnFwzbrLHMMzz
|
||||||
|
GqTBqhBqBvppBvMMTznrCbCnLwfr
|
||||||
|
RBjjpZZvvZqGcNhjjpNmDPfDcsgfDfgScsQQQg
|
||||||
|
rsSFccvBHppHPsvQrSHSprFjnbLGdbzLfbGLLtLjjzLzvl
|
||||||
|
JWWJhmwwTDTGtnzlhdbtLG
|
||||||
|
CWNqWRNCwnCJVppQFFFFNrgHBB
|
||||||
|
MSRVnMjnVRVnPlcsrtMtschgDl
|
||||||
|
NWHBwJBwBBQCHHqwWQGBNgdrFFtsthcqdltdDsqttq
|
||||||
|
CCTTGCNCCBfNJNNWbGGnvVzDSRfDRSZvLPSzRn
|
||||||
|
MpRfjRjWpZzzzRzZSpjzZjTCQcGdHLWNGqdBdcBWWBLccn
|
||||||
|
lrbrsPQDPQglDtwggcLCqnCdNNdHBLsqNd
|
||||||
|
blwbJggvgbwlvQbvtgwmvVwRfTzfMMjFVfSFjZjMTSTSzj
|
||||||
|
ttSGjHWVrwWrWWvhzvhmhDfR
|
||||||
|
qMBdNNsccQgfDRzRmqlhRl
|
||||||
|
gQJdfJPdQBsMggMjPrTCLjrGrCrtVT
|
||||||
|
tGFdlwDwGFdNtStghWWdQFSnTVfCfZhrfVTVCVprnRRhVn
|
||||||
|
cLsBPQJsQPmbmPHTnRRnHprCVfns
|
||||||
|
MjmvPqqQjPbQzjLwwDWDSlzSlGSgwl
|
||||||
|
NSCpFgfbscbZZZwrtgPZJT
|
||||||
|
zGCQlVGmmQGVqqJwGtHZGrPHHRTH
|
||||||
|
qQvVmvzmqCdhhjzCQLjljLQMnMDSFWcSfnMfpbfnNcFFbFDN
|
||||||
|
zFgqjQBmWNlWlfHrHdLc
|
||||||
|
wnbCpSSZZTJSJSnmdrtHfGtftlcpltpH
|
||||||
|
ZSwhVPPJgNVmNFzs
|
||||||
|
WNVJthVHRRfLqpqN
|
||||||
|
gdCGcCgJBCrgScRLzbjQQLfRRR
|
||||||
|
SCFdGSFvlhTJsnvW
|
||||||
|
FFZwFZZwRmFFhHtNLNLGRtsqjLMt
|
||||||
|
gbDnnrMbMCffMPbPLNjGNlcppNtspp
|
||||||
|
rgbzrzDrgVgnrBzFWMWmWBwHWHShSB
|
||||||
|
zjRVjDqzRjvSBnBGGsfsrFsV
|
||||||
|
fLccLLZpJMctwJWWWJWpJGCwFwsgnngFBPsCnnTBPT
|
||||||
|
LbJlZNWMtpMlHRNHzdfSDfdj
|
||||||
|
VGbbnJGSTsVTssTTnVVWMtfBBmvftRHfHBMJJfZp
|
||||||
|
ghqtrzgPrjdzQCjmZMHfRHZHBmQmmB
|
||||||
|
gltFtDqFVlTVWlTl
|
||||||
|
HqNqZDTvNvVTLPSTvzfrfHfdndffwnbdnwrH
|
||||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jPFHMLCCq
|
||||||
|
bggDpTggncGVVWbQcG
|
||||||
|
sRvSwwwFBSpFzvRvMFZqmPmMVqmcmPPVqhqqWq
|
||||||
|
SRBBrFZZwrddBFRjlptnLgDnTggdtd
|
||||||
|
PPfMcZMflbMQcMllPVfTVMwjWWmZvpWWpWhhjjpdWWww
|
||||||
|
sDQNnzsnQgDNsFzFqtGjGmWWSpWrGhdpvphdSW
|
||||||
|
nNQNqLBHLqzDnHgnVJfPJPCRBbfCcJlT
|
||||||
|
fppppWsjcSDPjjDpGhgwbfTgHTCbHJwbHbTR
|
||||||
|
rLBdQnvMNMmFPbLqHqTqgLHCgL
|
||||||
|
nrFznvMNMQdttrBcScsDstWcPGtWSc
|
||||||
|
lclnRSDnGZtvSwnZDZzhLffqdsCNwTBCBBdNsd
|
||||||
|
mPjmjmrFFpmQjMJQjlNdlhCsCLsTlNLs
|
||||||
|
ggmrHHVVQVPJpWrgpWScRvzZzGGRnZvlgzZn
|
||||||
|
GjGJGQJGcMTVfFDQzNVQzP
|
||||||
|
mHqdbmmdnJqVzVhRVNzPbR
|
||||||
|
wStmHJsJsLZLjTvM
|
||||||
|
QssMbVGdMQjZPjwVwHVZPZClllvgSgvlTgwwSSCgSCtC
|
||||||
|
WmmFBmJrcFRBFrJJBFchzWCStgCTgvhvTlfsNqfTlvTv
|
||||||
|
sFzzssDLzrBPjDVVddHMQD
|
||||||
|
fztDZSGrNrlnbnPTgFFpln
|
||||||
|
jvvQMMcLcjJmQwHdJvjQJnnbTbRFRphnnpsWgmFRPR
|
||||||
|
vTLHHCQLHBBjJCSZrVCZtSfSfrft
|
||||||
|
gHfHffHLjwHrRjLrLRZVMnTdTBsNTBwTVBsBnN
|
||||||
|
DWPhqhhDhvSGvWPzSzMBQBQVMMBBmvssvQvQ
|
||||||
|
CDGbqCDbChSbWGrHcHRgbcVcfrLJ
|
||||||
|
frlTLmtllbbbdpJS
|
||||||
|
qFjhzjThjHTFGHTjqhhjMzBhVpVpdbBnSJQRpBnVVdbRRQJd
|
||||||
|
vjWPWjWPPPWgwmfCrNvTvZ
|
69
day3/src/main.rs
Normal file
69
day3/src/main.rs
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
use std::{fs, env, collections::HashSet, vec};
|
||||||
|
|
||||||
|
|
||||||
|
fn read_input(path: &str) -> String {
|
||||||
|
return fs::read_to_string(path).expect("Cannot read file.");
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_input_part1(s: &str) -> Vec<(HashSet<char>, HashSet<char>)> {
|
||||||
|
return s.lines().into_iter().fold(vec![], |mut acc, x| {
|
||||||
|
let tuple = x.split_at(x.len() / 2);
|
||||||
|
acc.push((tuple.0.chars().collect(), tuple.1.chars().collect()));
|
||||||
|
return acc;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_intersections_2(v: &Vec<(HashSet<char>, HashSet<char>)>) -> Vec<char> {
|
||||||
|
return v.iter()
|
||||||
|
.map(|t|
|
||||||
|
t.0.intersection(&t.1).collect::<Vec<&char>>())
|
||||||
|
.flatten()
|
||||||
|
.map(|c| c.to_owned())
|
||||||
|
.collect();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn parse_input_part2(s: &str) -> Vec<(HashSet<char>, HashSet<char>, HashSet<char>)> {
|
||||||
|
let mut ret = vec![];
|
||||||
|
let mut iter = s.lines().into_iter();
|
||||||
|
loop {
|
||||||
|
let (a, b, c) = (iter.next(), iter.next(), iter.next());
|
||||||
|
if a.is_none() {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ret.push((
|
||||||
|
a.unwrap().chars().collect(),
|
||||||
|
b.unwrap().chars().collect(),
|
||||||
|
c.unwrap().chars().collect()
|
||||||
|
))
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_intersections_3(v: &Vec<(HashSet<char>, HashSet<char>, HashSet<char>)>) -> Vec<char> {
|
||||||
|
return v.iter()
|
||||||
|
.map(|t| {
|
||||||
|
let first = t.0.intersection(&t.1).map(|c| c.to_owned()).collect::<HashSet<char>>();
|
||||||
|
return first.intersection(&t.2).map(|c| c.to_owned()).collect::<Vec<char>>();
|
||||||
|
})
|
||||||
|
.flatten()
|
||||||
|
.collect();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_priority(c: &char) -> u32 {
|
||||||
|
return *c as u32 - if c.is_uppercase() { 'A' as u32 - 27 } else { 'a' as u32 - 1 } ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let args: Vec<String> = env::args().collect();
|
||||||
|
for arg in args.iter().skip(1) {
|
||||||
|
println!("[{}]", &arg);
|
||||||
|
let vec_in_part1 = parse_input_part1(&read_input(&arg));
|
||||||
|
let vec_in_part2 = parse_input_part2(&read_input(&arg));
|
||||||
|
let prio_sum_part1 = get_intersections_2(&vec_in_part1).iter().map(|x| get_priority(x)).sum::<u32>();
|
||||||
|
let prio_sum_part2 = get_intersections_3(&vec_in_part2).iter().map(|x| get_priority(x)).sum::<u32>();
|
||||||
|
println!("\t[Part 1] => Answer is '{}'.", prio_sum_part1);
|
||||||
|
println!("\t[Part 2] => Answer is '{}'.", prio_sum_part2);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user