27 lines
608 B
Rust
27 lines
608 B
Rust
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);
|
|
}
|