Day 19, part 1
This commit is contained in:
26
src/bin/d19p1.rs
Normal file
26
src/bin/d19p1.rs
Normal file
@ -0,0 +1,26 @@
|
||||
use std::thread;
|
||||
|
||||
use aoc22::{day19, util};
|
||||
|
||||
const MINUTES: usize = 24;
|
||||
|
||||
pub fn main() {
|
||||
let blueprints = day19::parse_blueprints(&util::parse_input());
|
||||
|
||||
let mut handles = Vec::new();
|
||||
for (i, blueprint) in blueprints.iter().enumerate() {
|
||||
let blueprint = blueprint.clone();
|
||||
handles.push((
|
||||
i,
|
||||
thread::spawn(move || day19::max_geodes(MINUTES, &blueprint)),
|
||||
));
|
||||
}
|
||||
|
||||
let mut sum = 0;
|
||||
for (i, handle) in handles {
|
||||
let max = handle.join().unwrap();
|
||||
sum += (i + 1) * max;
|
||||
}
|
||||
|
||||
println!("Sum of quality scores: {}", sum);
|
||||
}
|
||||
Reference in New Issue
Block a user