1
0
This commit is contained in:
2022-12-27 01:46:31 +00:00
parent 8fbaaa4bbc
commit e871837dc6
11 changed files with 110 additions and 86 deletions

View File

@ -1,4 +1,4 @@
use std::{collections::HashSet, cmp::min};
use std::{cmp::min, collections::HashSet};
fn main() {
const INPUT: &str = include_str!("../input.txt");
@ -10,10 +10,16 @@ fn main() {
let (first, second) = line.split_once(',').unwrap();
let first: (&str, &str) = first.split_once('-').unwrap();
let first: (u64, u64) = (first.0.parse::<u64>().unwrap(), first.1.parse::<u64>().unwrap());
let first: (u64, u64) = (
first.0.parse::<u64>().unwrap(),
first.1.parse::<u64>().unwrap(),
);
let second: (&str, &str) = second.split_once('-').unwrap();
let second: (u64, u64) = (second.0.parse::<u64>().unwrap(), second.1.parse::<u64>().unwrap());
let second: (u64, u64) = (
second.0.parse::<u64>().unwrap(),
second.1.parse::<u64>().unwrap(),
);
let first_set: HashSet<u64> = HashSet::from_iter(first.0..=first.1);
let second_set: HashSet<u64> = HashSet::from_iter(second.0..=second.1);