Add part 1 solution
This commit is contained in:
parent
ffe2432af5
commit
92306ca539
2 changed files with 337 additions and 7 deletions
300
etc/p03.txt
Normal file
300
etc/p03.txt
Normal file
|
@ -0,0 +1,300 @@
|
|||
RCMRQjLLWGTjnlnZwwnZJRZH
|
||||
qnvfhpSbvSppNddNdSqbbmmdPrwttJVrVPDVrJtHtwPZhrPJ
|
||||
BFpFzSSqSFFSvQsnWgCMjTLzng
|
||||
DbWVcVRRdlLffvtqjTWNgQ
|
||||
mJJMpsmrMrJSHJpsHrFHvBvgHvqfNvzffgTvfj
|
||||
mMhPjmjmFPJhMSGGcDRlwRdcLGPc
|
||||
qFcbmWFJqqWpRJcQWpqsQQQwSPCPrHRHCPdNZtSrSHwrNZ
|
||||
jGMjGLhhhgTvghgtGVjnNCrPVwZSZffSNSwHZZdH
|
||||
DvzDlvvhnjlMlglglGGhDLpqqcJWWtsmszpWbBBBmQmb
|
||||
SPLPHQbJSbPsvTLmfDvVDctvWhcDlD
|
||||
jdRRzzGgJqwrpMRMgdjlcVcWqfWWlfDlmmlWhB
|
||||
rwgRGdpGprNNLQLsbZJPsn
|
||||
GZhTVLztHrSzrRBz
|
||||
MJWjMvsfSCLSnrJn
|
||||
MjglcgWMdccvZGFtTDchLLLh
|
||||
rgDHBgBjRgRTgwzwthBnQwmBtB
|
||||
MsMpSfMsTGTFFLdFFFMFsnNmthNnzhthtwmWnznz
|
||||
pZMpJdvJMGRHVJJTVHjb
|
||||
TQVqZVBcBBdBfbpN
|
||||
zvzrtCshrntCHslPMMMFpZHbNSpb
|
||||
hLWhGLttsvLvrrWvhzVmQgwJZTRcggTjGcgT
|
||||
SqRGLHtSbtNTbhjFTjDDpF
|
||||
WwgJgmdmMdwPDVQQBBhSBFwV
|
||||
JMPlmlSldWZmRqtLsRGRtvls
|
||||
mZvmvPNmlNJPJzzmgNvNgdqqdBSpfHBqSsHqHfwpsffq
|
||||
nhDQDrwLrVVnqfGnsBGBGGsH
|
||||
VjCDMhbDjLjtFhtLh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NZfJJbTJTmR
|
||||
CHGCHFcZvCrchrZrhsVtsBQjMstfZMMBgg
|
||||
NNqwDLmDjJgQBmVQ
|
||||
wdWLLTgWRTWcCcbrHCHhGW
|
||||
bTZZvNjNjLgTCHcWhccfhWJdhvnc
|
||||
mnFFmPGSwRPShzVPPWPdhhzr
|
||||
FRtBFGBMFQFttRwtZgTjCTnQNbNLjTCH
|
||||
bJSqrSpDJbSNbFjSFCfPWGcwGWPrcTCfwr
|
||||
tRtLhDsvhQZlHRhRtQQnCnCcdwCPwTwdGcGP
|
||||
HsHvsmBZvmvsmBhHvLssVqDSNgFMDzgbbDVJzbpMVq
|
||||
nSSDHRRRQRBCLCQC
|
||||
qGmfPzGmGlrrrpfrqlzrJtLvBlhQbSCvbtCtlFhLFC
|
||||
zzpmqqJJVVfJfPfMpfdHNndsNwDSMSDDNcsc
|
||||
CscQsVMhCsMsMHhhVthtwmgZNRqzWLBRLRLmBWmZWBND
|
||||
JQJdddrjrLqBgDBq
|
||||
QbFlTffpMbMnsPCh
|
||||
gDdbVbVDddDfVfWQfBRLQZsZLRQQ
|
||||
FCCTrGCMStwGHTtTWLQhLZrlRssRhRhp
|
||||
FSHqtFTmFwmCsSwGTHtMTSdjjcdnVddgzmbVmjmndbbD
|
||||
JtBBMcLWLdfFLhMttcWWhfWLrTRGFsbwTmRGwmwbbCTGGsbD
|
||||
PzQpSQQQvzVvpzHqjvNvQSvGRmmTDVRDmsGsRGsrcDcDGC
|
||||
cQPHSPvPvZHqcZjzpZjnZNtWlLdtldJWfnfhlJJtLdMg
|
||||
nPPssTBnMJPdtHPVHtRhpv
|
||||
bSSgGFWDgWwDFFlmWlcShqdpRqpVcHvvnqpvpRHd
|
||||
bGFnGljgSsjBCTBszz
|
|
@ -1,23 +1,53 @@
|
|||
#![feature(iterator_try_collect)]
|
||||
|
||||
use std::fs;
|
||||
use std::io::{self, BufRead, Read, Seek};
|
||||
use std::io::{self, BufRead};
|
||||
use std::collections::HashSet;
|
||||
|
||||
|
||||
fn main() {
|
||||
let filename = "etc/p03.txt";
|
||||
let file = fs::File::open(filename).expect("Can't open file");
|
||||
let mut reader = io::BufReader::new(file);
|
||||
let reader = io::BufReader::new(file);
|
||||
|
||||
println!("PART ONE ---------------");
|
||||
part1(reader.by_ref().lines());
|
||||
reader.rewind().expect("Can't rewind");
|
||||
let lines = reader.lines().try_collect().expect("Expected all lines to be valid");
|
||||
part1(&lines);
|
||||
|
||||
println!("\n PART TWO ---------------");
|
||||
part2(reader.lines());
|
||||
part2(&lines);
|
||||
}
|
||||
|
||||
fn part1(lines: impl Iterator<Item = std::io::Result<String>>) {
|
||||
fn to_priority(c: char) -> Result<u32, &'static str> {
|
||||
if c.is_ascii_uppercase() {
|
||||
Ok(c as u32 - 'A' as u32 + 26 + 1)
|
||||
} else if c.is_ascii_lowercase() {
|
||||
Ok(c as u32 - 'a' as u32 + 1)
|
||||
} else {
|
||||
Err("Can't convert non-alphanumeric")
|
||||
}
|
||||
}
|
||||
|
||||
fn part2(lines: impl Iterator<Item = std::io::Result<String>>) {
|
||||
fn part1(lines: &Vec<String>) {
|
||||
let mut sum: u32 = 0;
|
||||
for line in lines {
|
||||
let (left, right) = line.split_at(line.len() / 2);
|
||||
let left_set = HashSet::<char>::from_iter(left.chars());
|
||||
let mut right_set = HashSet::<char>::new();
|
||||
let outlier = right.chars().find(|c| {
|
||||
right_set.insert(*c);
|
||||
left_set.contains(c)
|
||||
}).expect("Expected at least one duplicate item");
|
||||
|
||||
let priority = to_priority(outlier).unwrap();
|
||||
println!("{} ({})", outlier, priority);
|
||||
sum += priority;
|
||||
}
|
||||
|
||||
println!("Sum: {}", sum);
|
||||
}
|
||||
|
||||
fn part2(_lines: &Vec<String>) {
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Reference in a new issue