commit b9b487d3853dbbe986582904dc70052643adf208 parent cc16497716463dfe0109a978633d8c701638461f Author: Shimmy Xu <shimmy.xu@shimmy1996.com> Date: Sat, 3 Dec 2022 08:17:39 -0500 Add 2022 day 03 Diffstat:
A | 2022/day03/input.txt | | | 300 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
A | 2022/day03/main.rs | | | 55 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2 files changed, 355 insertions(+), 0 deletions(-) diff --git a/2022/day03/input.txt b/2022/day03/input.txt @@ -0,0 +1,300 @@ +shzsFcPssFhjFssBzdpRcNHNZrpdJdJVJZ +fwvMCntfCCbSbSbtDgDNrDtDtJHZVH +GbCwwbwwnGrLhBzjFFFsWPhL +PpCqRsqqmmtCwMJC +LHFrLLHDSNHlfWNhDzmjzzJlJzPJMvPJjQ +SGSWDNrhZhPDSWDZLgVVRgbRppgpGVnpnn +GRRjbVjmJZlgMRzzrN +FpDptHpfHfnpPTvDFTWpFPnPcMfNCClNrzcVcrMMzVsCZlsZ +TFTQDnvLHPFDtVbLwbjdGjdwwJ +lhljvvhCjjzhjszzBPmnmGVZMGzG +FbTcTwbtSFdtcMPnTBPQVnnBZT +SFMpHDtNDSSbSdwppvgJWjJCJJgWgvlJHH +wzNCWpzCzJnWWpRRNdJrgHLhjfbLrHrchV +lBMStmPmmLQDPQZlshrdhgrfrcrrddgHgs +mvGDGQSvDPBlGMLGCvCWpNvpzRWFwqRw +stBttBThtDZqPWssPWZp +gRggwwggCGFSBBvPRpHZZrHdZLZq +ccFJGCNJmmGQzbTDhnQhBBnB +HJqMqtZbJMmJTqtLtVMqhpfphNdQfhfzzjhhlHll +rWSBrnwFwWCvwWCwBgPgCgzjQccQhhgRzcdQzjfcNfzR +CWBCwCvCvvwssWLMtJJGMdMZJsGV +nFwSFQwsNrrsssSwCrhrCNnfcCRgJRMJTJcMfRzMCMCRvW +DdbGdLZLttllWWvTzgzzgR +ZqGzPdLtDjBjDZG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fQfgWgRWhdhjtgdRM +JBwnHwgFFqVJrsGmPvNTPsVvSN +ZJnfZNnDNZJLzNntDtDNNzNWTVBPrrvRRGdBcVRfPPcvfdMr +CFgjFmggQSQQmSggVMMvRdTvBVRjrdrc +mbsqQFqFgwwmgmSbwQWWLDWzpLcLnzZzLbLL +PnwSFSLSTwbbHdtstW +RrDZVVfJNZCmDCfVDVlblZHbddtHScbWbMjt +NmzqhzCCqmzffhCCqrhhLLnPvpnTPPgpGTTBSL +ShhfLSDDFMPQddpMrDgNbjzffqqqzgcjbqZR +sCstmwJwVBtmTltVmTVbRbcbcRvqvrZvBRvZbR +VwCnwnVrrrWShWPHHDdQFL +pbpDpWjZMmFCmmmb +jTjtJLJgJncCFmnJFC +LvhvhTQhBSdRNtLNsSszlGrHSGjZDlGf +JrhvTNJJhhCrtVtcrNLwDBSBwqzDwQVbBLQS +RnCgHmHHGMdPsGMfDlDqlSQbQnQQDbzD +RdPMPsmWHmjfMffPcCWrptcprpFTFrFp diff --git a/2022/day03/main.rs b/2022/day03/main.rs @@ -0,0 +1,55 @@ +use std::collections::HashSet; + +fn get_priority(c: char) -> i32 { + match c { + 'a'..='z' => c as i32 - 'a' as i32 + 1, + 'A'..='Z' => c as i32 - 'A' as i32 + 27, + _ => unreachable!(), + } +} + +fn main() { + let input = std::fs::read_to_string("input.txt") + .unwrap() + .trim() + .split("\n") + .map(|x| x.chars().collect()) + .collect::<Vec<Vec<char>>>(); + // 8185 + println!("Part 1: {}", part_1(&input)); + // 2817 + println!("Part 2: {}", part_2(&input)); +} + +fn part_1(input: &Vec<Vec<char>>) -> i32 { + input + .iter() + .map(|cv| { + let first = cv[0..(cv.len() / 2)] + .iter() + .map(|&x| x) + .collect::<HashSet<char>>(); + get_priority( + *cv[(cv.len() / 2)..cv.len()] + .iter() + .find(|c| first.contains(c)) + .unwrap(), + ) + }) + .sum() +} + +fn part_2(input: &Vec<Vec<char>>) -> i32 { + input + .chunks(3) + .map(|cvv| { + let first = cvv[0].iter().map(|&x| x).collect::<HashSet<char>>(); + let second = cvv[1] + .iter() + .filter(|c| first.contains(c)) + .map(|&x| x) + .collect::<HashSet<char>>(); + get_priority(*cvv[2].iter().find(|c| second.contains(c)).unwrap()) + }) + .sum() +}